Skip to content

Commit

Permalink
Run tabix and report errors (#30)
Browse files Browse the repository at this point in the history
* Run tabix and report errors

* Update to imputationserver-utils v1.5.0

* Disable VCF index creation in validate cmd
  • Loading branch information
seppinho authored Sep 30, 2024
1 parent b9f7262 commit 93d5b98
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ RUN wget https://github.com/lukfor/pgs-calc/releases/download/v${PGS_CALC_VERSIO
ENV PATH="/opt/pgs-calc:${PATH}"

# Install imputationserver-utils
ENV IMPUTATIONSERVER_UTILS_VERSION=v1.4.5
ENV IMPUTATIONSERVER_UTILS_VERSION=v1.5.0
RUN mkdir /opt/imputationserver-utils
WORKDIR "/opt/imputationserver-utils"
#COPY files/imputationserver-utils.tar.gz .
Expand Down
13 changes: 13 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 All @@ -34,6 +46,7 @@ process INPUT_VALIDATION_VCF {
--minSamples ${params.min_samples} \
--maxSamples ${params.max_samples} \
--report validation_report.txt \
--no-index \
--contactName "${(params.service.contact == "" || params.service.contact == null) ? "Admin" : params.service.contact}" \
--contactEmail "${(params.service.email == "" || params.service.email == null) ? "admin@localhost" : params.service.email}" \
$vcf_files
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 93d5b98

Please sign in to comment.