Skip to content

Commit

Permalink
Run tabix and report errors
Browse files Browse the repository at this point in the history
  • Loading branch information
seppinho committed Sep 30, 2024
1 parent 98e3059 commit cfe2218
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/local/input_validation/input_validation_vcf.nf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ process INPUT_VALIDATION_VCF {
set +e
echo '${JsonOutput.toJson(params.refpanel)}' > reference-panel.json
# Verify if VCF files are valid
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
echo "The provided VCF file is malformed."
echo "Error: \$output"
echo ::endgroup::
exit 1
fi
done
java -Xmx${avail_mem}M -jar /opt/imputationserver-utils/imputationserver-utils.jar \
validate \
--population ${params.population} \
Expand Down
Binary file added tests/data/input/invalid-vcfs/unsorted.vcf.gz
Binary file not shown.
22 changes: 22 additions & 0 deletions tests/main.validate.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,26 @@ 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"
allele_frequency_population = "eur"
mode = "qc-only"
refpanel_yaml = "$projectDir/tests/data/refpanels/hapmap2/cloudgene.yaml"
output = "${outputDir}"
}
}

then {
assert workflow.failed

}

}

}

0 comments on commit cfe2218

Please sign in to comment.