Skip to content

Commit

Permalink
Merge pull request #102 from theiagen/smw-patch-dev
Browse files Browse the repository at this point in the history
Snippy Gene Query fixes
  • Loading branch information
kevinlibuit authored Jul 19, 2023
2 parents 41131b6 + 194d34c commit affc302
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
7 changes: 4 additions & 3 deletions tasks/gene_typing/task_snippy_gene_query.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ task snippy_gene_query {
File snippy_variants_results
String? query_gene
File? reference
String docker = "quay.io/theiagen/utility:1.2"
String docker = "quay.io/theiagen/terra-tools:2023-06-21"
Int cpus = 8
Int memory = 32
}
Expand All @@ -15,7 +15,7 @@ task snippy_gene_query {
if [ -z "~{query_gene}" ]; then
no_hit="NA: No query gene was provided"
else
no_hit="No variants identified in queried genes (~{query_gene})"
no_hit="No variants identified in queried genes (~{query_gene}) relative to the reference genome "
fi

# if provided, check that query gene strings are present in reference genome
Expand Down Expand Up @@ -43,7 +43,8 @@ task snippy_gene_query {
if grep -q "${qgene}" ~{snippy_variants_results}; then
grep "${qgene}" ~{snippy_variants_results} | awk '{print "'~{samplename}'," $0}' >> ./gene_query.csv
# curate relevant columns of queried hits to single output
grep "${qgene}" ./gene_query.csv | awk -F"," '{print "'${qgene}': "$15" ("$12"; "$7")"}' >> snippy_variant_hits_tmp
# awk syntax: see https://stackoverflow.com/questions/29642102/how-to-make-awk-ignore-the-field-delimiter-inside-double-quotes?noredirect=1&lq=1
grep "${qgene}" ./gene_query.csv | awk -vFPAT='([^,]*)|("[^"]+")' -vOFS=, '{print "'${qgene}': "$15" ("$12"; "$7")"}' >> snippy_variant_hits_tmp
fi
done

Expand Down
1 change: 1 addition & 0 deletions tasks/gene_typing/task_snippy_variants.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ task snippy_variants {
output {
String snippy_variants_version = read_string("VERSION")
String snippy_variants_docker = docker
File snippy_variants_reference_genome = "~{reference_genome_file}"
File snippy_variants_outdir_tarball = "./~{samplename}_snippy_variants_outdir.tar"
Array[File] snippy_variants_outputs = glob("~{samplename}/~{samplename}*")
File snippy_variants_results = "~{samplename}/~{samplename}.csv"
Expand Down
4 changes: 2 additions & 2 deletions tests/workflows/theiaprok/test_wf_theiaprok_illumina_pe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@
- path: miniwdl_run/wdl/tasks/gene_typing/task_resfinder.wdl
md5sum: b50d1c42e23fe6643e127c539d03eda3
- path: miniwdl_run/wdl/tasks/gene_typing/task_snippy_variants.wdl
md5sum: 138cac57599c2fff7c6646d60033d2ec
md5sum: 72185fe726e83be5242a7e11401823a9
- path: miniwdl_run/wdl/tasks/quality_control/task_bbduk.wdl
md5sum: 501ac92b8a4a605ec178d879e40e9b00
- path: miniwdl_run/wdl/tasks/quality_control/task_busco.wdl
Expand Down Expand Up @@ -638,7 +638,7 @@
- path: miniwdl_run/wdl/workflows/theiaprok/wf_theiaprok_illumina_pe.wdl
md5sum: e98bdaa0c00d01b5e77859713ab91689
- path: miniwdl_run/wdl/workflows/utilities/wf_merlin_magic.wdl
md5sum: 01f665f21ec65aa77a43a68694c4f1f3
md5sum: 33f917eae3094f0c74ba895b3b1d4c9d
- path: miniwdl_run/wdl/workflows/utilities/wf_read_QC_trim_pe.wdl
md5sum: 40d4e09a82030c8219b37f883cddaca4
- path: miniwdl_run/workflow.log
Expand Down
4 changes: 2 additions & 2 deletions tests/workflows/theiaprok/test_wf_theiaprok_illumina_se.yml
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@
- path: miniwdl_run/wdl/tasks/gene_typing/task_resfinder.wdl
md5sum: b50d1c42e23fe6643e127c539d03eda3
- path: miniwdl_run/wdl/tasks/gene_typing/task_snippy_variants.wdl
md5sum: 138cac57599c2fff7c6646d60033d2ec
md5sum: 72185fe726e83be5242a7e11401823a9
- path: miniwdl_run/wdl/tasks/quality_control/task_bbduk.wdl
md5sum: 501ac92b8a4a605ec178d879e40e9b00
- path: miniwdl_run/wdl/tasks/quality_control/task_busco.wdl
Expand Down Expand Up @@ -606,7 +606,7 @@
- path: miniwdl_run/wdl/workflows/theiaprok/wf_theiaprok_illumina_se.wdl
md5sum: 17be58829cc4e6a1780cf227a2ec99ac
- path: miniwdl_run/wdl/workflows/utilities/wf_merlin_magic.wdl
md5sum: 01f665f21ec65aa77a43a68694c4f1f3
md5sum: 33f917eae3094f0c74ba895b3b1d4c9d
- path: miniwdl_run/wdl/workflows/utilities/wf_read_QC_trim_se.wdl
md5sum: 53d322d895837c0bcb049786572e944d
- path: miniwdl_run/workflow.log
Expand Down
1 change: 1 addition & 0 deletions workflows/theiaeuk/wf_theiaeuk_illumina_pe.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ workflow theiaeuk_illumina_pe {
String? theiaeuk_snippy_variants_query = merlin_magic.snippy_variants_query
String? theiaeuk_snippy_variants_query_check = merlin_magic.snippy_variants_query_check
String? theiaeuk_snippy_variants_hits = merlin_magic.snippy_variants_hits
File? theiaeuk_snippy_variants_reference_genome = merlin_magic.snippy_variants_reference_genome
File? theiaeuk_snippy_variants_gene_query_results = merlin_magic.snippy_variants_gene_query_results
# Array[File]? snippy_outputs = merlin_magic.snippy_outputs
File? theiaeuk_snippy_variants_results = merlin_magic.snippy_variants_results
Expand Down
1 change: 1 addition & 0 deletions workflows/utilities/wf_merlin_magic.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ workflow merlin_magic {
String? cladetyper_docker_image = cladetyper.gambit_cladetyper_docker_image
String? cladetype_annotated_ref = cladetyper.clade_spec_ref
# snippy variants
String snippy_variants_reference_genome = select_first([snippy_cauris.snippy_variants_reference_genome, snippy_afumigatus.snippy_variants_reference_genome, snippy_crypto.snippy_variants_reference_genome, "No reference genome detected"])
String snippy_variants_version = select_first([snippy_cauris.snippy_variants_version, snippy_afumigatus.snippy_variants_version, snippy_crypto.snippy_variants_version, "No matching taxon detected"])
String snippy_variants_query = select_first([snippy_gene_query_cauris.snippy_variants_query, snippy_gene_query_afumigatus.snippy_variants_query, snippy_gene_query_crypto.snippy_variants_query, "No matching taxon detected"])
String snippy_variants_query_check = select_first([snippy_gene_query_cauris.snippy_variants_query_check, snippy_gene_query_afumigatus.snippy_variants_query_check, snippy_gene_query_crypto.snippy_variants_query_check, "No matching taxon detected"])
Expand Down

0 comments on commit affc302

Please sign in to comment.