Skip to content

Commit

Permalink
✨ Add HAPPY task and test files
Browse files Browse the repository at this point in the history
  • Loading branch information
lmtani committed Dec 18, 2023
1 parent 10ebf3f commit f500b64
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 0 deletions.
69 changes: 69 additions & 0 deletions tasks/happy/happy.wdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
version 1.0

task HAPPY {
input {
File truth_vcf
File query_vcf
String prefix
File fasta
File fasta_fai
File? regions_bed
File? targets_bed
File? false_positives_bed
File? stratification_tsv

Int cpus
Boolean stub = false
}


command <<<
hap.py -v > version.txt # It's not working as expected. Just prints Hap.py

if [ ~{stub} == "true" ]; then
touch ~{prefix}.summary.csv \
~{prefix}.roc.all.csv.gz \
~{prefix}.roc.Locations.INDEL.csv.gz \
~{prefix}.roc.Locations.INDEL.PASS.csv.gz \
~{prefix}.roc.Locations.SNP.csv.gz \
~{prefix}.roc.Locations.SNP.PASS.csv.gz \
~{prefix}.extended.csv \
~{prefix}.runinfo.json \
~{prefix}.metrics.json.gz \
~{prefix}.vcf.gz \
~{prefix}.vcf.gz.tbi
exit 0
fi

hap.py \
~{truth_vcf} \
~{query_vcf} \
~{"--reference " + fasta} \
~{"--threads " + cpus} \
~{"--R " + regions_bed } \
~{"--T " + targets_bed } \
~{"--false-positives " + false_positives_bed} \
~{"--stratification " + stratification_tsv} \
-o ~{prefix}
>>>

output {
File summary_csv = "~{prefix}.summary.csv"
File roc_all_csv = "~{prefix}.roc.all.csv.gz"
File roc_indel_locations_csv = "~{prefix}.roc.Locations.INDEL.csv.gz"
File roc_indel_locations_pass_csv = "~{prefix}.roc.Locations.INDEL.PASS.csv.gz"
File roc_snp_locations_csv = "~{prefix}.roc.Locations.SNP.csv.gz"
File roc_snp_locations_pass_csv = "~{prefix}.roc.Locations.SNP.PASS.csv.gz"
File extended_csv = "~{prefix}.extended.csv"
File runinfo = "~{prefix}.runinfo.json"
File metrics_json = "~{prefix}.metrics.json.gz"
File vcf = "~{prefix}.vcf.gz"
File tbi = "~{prefix}.vcf.gz.tbi"
File version = "version.txt"
}

runtime {
docker: "quay.io/biocontainers/hap.py:0.3.14--py27h5c5a3ab_0"
cpu: cpus
}
}
9 changes: 9 additions & 0 deletions tests/tasks/happy/happy/inputs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"truth_vcf": "truth.vcf.gz",
"query_vcf": "query.vcf.gz",
"prefix": "benchmark-outputs",
"fasta": "reference.fasta",
"fasta_fai": "reference.fasta.fai",
"cpus": 4,
"stub": true
}
5 changes: 5 additions & 0 deletions tests/tasks/happy/happy/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set -e

touch truth.vcf.gz query.vcf.gz reference.fasta reference.fasta.fai

miniwdl run --task HAPPY -i tests/tasks/happy/happy/inputs.json tasks/happy/happy.wdl
28 changes: 28 additions & 0 deletions tests/tasks/happy/happy/test_happy_task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
- name: Check if HAPPY produces the expected outputs
tags:
- happy/happy
command: bash tests/tasks/happy/happy/run.sh
files:
- path: _LAST/out/summary_csv/benchmark-outputs.summary.csv
- path: _LAST/out/roc_all_csv/benchmark-outputs.roc.all.csv.gz
- path: _LAST/out/roc_indel_locations_csv/benchmark-outputs.roc.Locations.INDEL.csv.gz
- path: _LAST/out/roc_indel_locations_pass_csv/benchmark-outputs.roc.Locations.INDEL.PASS.csv.gz
- path: _LAST/out/roc_snp_locations_csv/benchmark-outputs.roc.Locations.SNP.csv.gz
- path: _LAST/out/roc_snp_locations_pass_csv/benchmark-outputs.roc.Locations.SNP.PASS.csv.gz
- path: _LAST/out/extended_csv/benchmark-outputs.extended.csv
- path: _LAST/out/runinfo/benchmark-outputs.runinfo.json
- path: _LAST/out/metrics_json/benchmark-outputs.metrics.json.gz
- path: _LAST/out/vcf/benchmark-outputs.vcf.gz
- path: _LAST/out/tbi/benchmark-outputs.vcf.gz.tbi
- path: _LAST/out/version/version.txt
contains:
- "Hap.py"
- path: _LAST/command
contains:
- "hap.py \\"
- "-o benchmark-outputs"
- "--threads 4"
contains_regex:
- "--reference .+\\/reference.fasta"
- ".+\\/truth.vcf.gz"
- ".+\\/query.vcf.gz"

0 comments on commit f500b64

Please sign in to comment.