diff --git a/tasks/species_typing/task_tbp_parser.wdl b/tasks/species_typing/task_tbp_parser.wdl index 511cefd0f..c18bbd098 100644 --- a/tasks/species_typing/task_tbp_parser.wdl +++ b/tasks/species_typing/task_tbp_parser.wdl @@ -13,7 +13,7 @@ task tbp_parser { Int coverage_threshold = 100 Boolean tbp_parser_debug = false - String docker = "us-docker.pkg.dev/general-theiagen/theiagen/tbp-parser:1.1.1" + String docker = "us-docker.pkg.dev/general-theiagen/theiagen/tbp-parser:1.1.4" Int disk_size = 100 Int memory = 4 Int cpu = 1 @@ -41,6 +41,9 @@ task tbp_parser { # get genome average depth samtools depth -J ~{tbprofiler_bam} | awk -F "\t" '{sum+=$3} END { print sum/NR }' | tee AVG_DEPTH + + # add sample id to the beginning of the coverage report + awk '{print "~{samplename},"$0}' ~{samplename}.percent_gene_coverage.csv > tmp.csv && mv -f tmp.csv ~{samplename}.percent_gene_coverage.csv >>> output { File tbp_parser_looker_report_csv = "~{samplename}.looker_report.csv" diff --git a/tasks/species_typing/task_tbprofiler.wdl b/tasks/species_typing/task_tbprofiler.wdl index bb8b4e21d..5e56db8e9 100644 --- a/tasks/species_typing/task_tbprofiler.wdl +++ b/tasks/species_typing/task_tbprofiler.wdl @@ -9,7 +9,8 @@ task tbprofiler { String tbprofiler_docker_image = "us-docker.pkg.dev/general-theiagen/staphb/tbprofiler:4.4.2" Int disk_size = 100 String mapper = "bwa" - String caller = "freebayes" + String variant_caller = "freebayes" + String? variant_calling_params Int min_depth = 10 Float min_af = 0.1 Float min_af_pred = 0.1 @@ -42,7 +43,6 @@ task tbprofiler { # check if new database file is provided and not empty if [ "~{tbprofiler_run_custom_db}" = true ] ; then - echo "Found new database file ~{tbprofiler_custom_db}" prefix=$(basename "~{tbprofiler_custom_db}" | sed 's/\.tar\.gz$//') echo "New database will be created with prefix $prefix" @@ -53,11 +53,8 @@ task tbprofiler { tb-profiler load_library ./"$prefix"/"$prefix" TBDB="--db $prefix" - else - TBDB="" - fi # Run tb-profiler on the input reads with samplename prefix @@ -66,11 +63,11 @@ task tbprofiler { ${INPUT_READS} \ --prefix ~{samplename} \ --mapper ~{mapper} \ - --caller ~{caller} \ + --caller ~{variant_caller} \ + --calling_params "~{variant_calling_params}" \ --min_depth ~{min_depth} \ --af ~{min_af} \ - --reporting_af \ - ~{min_af_pred} \ + --reporting_af ~{min_af_pred} \ --coverage_fraction_threshold ~{cov_frac_threshold} \ --csv --txt \ $TBDB @@ -81,6 +78,11 @@ task tbprofiler { # touch optional output files because wdl touch GENE_NAME LOCUS_TAG VARIANT_SUBSTITUTIONS OUTPUT_SEQ_METHOD_TYPE + # merge all vcf files if multiple are present + bcftools index ./vcf/*bcf + bcftools index ./vcf/*gz + bcftools merge --force-samples ./vcf/*bcf ./vcf/*gz > ./vcf/~{samplename}.targets.csq.merged.vcf + python3 <