Skip to content

Commit

Permalink
Fix loop iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
seppinho committed Sep 30, 2024
1 parent 04bf59d commit f1862f2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/local/input_validation/input_validation_vcf.nf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ process INPUT_VALIDATION_VCF {
echo '${JsonOutput.toJson(params.refpanel)}' > reference-panel.json
# Verify if VCF files are valid
for vcf in "$vcf_files"; do
for vcf in $vcf_files; do
# Attempt to create the index using tabix
if ! output=\$(tabix -p vcf "\$vcf" 2>&1); then
echo ::group type=error
Expand Down
25 changes: 22 additions & 3 deletions tests/main.validate.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,33 @@ nextflow_pipeline {
name "Pipeline Tests for Input Validation"
script "main.nf"

test("Should pass with several files") {

when {
params {
project = "test-job"
build = "hg19"
files = "$projectDir/tests/data/input/three/*.vcf.gz"
allele_frequency_population = "eur"
mode = "qc-only"
refpanel_yaml = "$projectDir/tests/data/refpanels/hapmap2/cloudgene.yaml"
output = "${outputDir}"
}
}

then {
assert workflow.success
}

}

test("Should fail due to wrong path") {

when {
params {
project = "test-job"
build = "hg19"
files = "$projectDir/tests/data/input/chr20-phased/*.vcf.gzz"
files = "$projectDir/tests/data/input/chr20-phased/*.vcf.gz"
allele_frequency_population = "eur"
mode = "qc-only"
refpanel_yaml = "$projectDir/tests/data/refpanels/hapmap2/cloudgene.yaml"
Expand All @@ -23,14 +43,13 @@ nextflow_pipeline {

}


test("Should fail due to unsorted file") {

when {
params {
project = "test-job"
build = "hg19"
files = "$projectDir/tests/data/input/invalid-vcfs/unsorted.vcf.gz"
files = "$projectDir/tests/data/input/invalid-vcfs/*.vcf.gz"
allele_frequency_population = "eur"
mode = "qc-only"
refpanel_yaml = "$projectDir/tests/data/refpanels/hapmap2/cloudgene.yaml"
Expand Down

0 comments on commit f1862f2

Please sign in to comment.