-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from theiagen/jro-snippy_tree-dev
Add snippy core and snippy tree workflows
- Loading branch information
Showing
9 changed files
with
216 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
version 1.0 | ||
|
||
task gubbins { | ||
input { | ||
File alignment | ||
String cluster_name | ||
String docker = "sangerpathogens/gubbins" | ||
Int? filter_percent = 25 #default is 25% | ||
Int? iterations = 5 | ||
String? tree_builder = "raxml" | ||
String? tree_args | ||
String? nuc_subst_model = "GTRGAMMA" | ||
Int? bootstrap = 0 | ||
String? outgroup | ||
File? dates_file | ||
} | ||
command <<< | ||
# date and version control | ||
date | tee DATE | ||
run_gubbins.py --version | tee VERSION | ||
|
||
run_gubbins.py \ | ||
~{alignment} \ | ||
--prefix ~{cluster_name} \ | ||
--filter-percentage ~{filter_percent} \ | ||
--iterations ~{iterations} \ | ||
--tree-builder ~{tree_builder} \ | ||
~{'--tree-args ' + tree_args} \ | ||
~{'--model ' + nuc_subst_model} \ | ||
--bootstrap ~{bootstrap} \ | ||
~{'--outgroup ' + outgroup} \ | ||
~{'--date ' + dates_file} \ | ||
--threads 2 | ||
>>> | ||
output { | ||
String date = read_string("DATE") | ||
String version = read_string("VERSION") | ||
File gubbins_final_tree = "~{cluster_name}.final_tree.tre" | ||
File gubbins_final_labelled_tree = "~{cluster_name}.node_labelled.final_tree.tre" | ||
File gubbins_polymorphic_fasta = "~{cluster_name}.filtered_polymorphic_sites.fasta" | ||
File gubbins_recombination_gff = "~{cluster_name}.recombination_predictions.gff" | ||
File gubbins_branch_stats = "~{cluster_name}.per_branch_statistics.csv" | ||
File? gubbins_timetree = "~{cluster_name}.final_tree.timetree.tre" | ||
File? gubbins_timetree_stats = "~{cluster_name}.lsd.out" | ||
} | ||
runtime { | ||
docker: "~{docker}" | ||
memory: "32 GB" | ||
cpu: 4 | ||
disks: "local-disk 100 SSD" | ||
preemptible: 0 | ||
maxRetries: 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
version 1.0 | ||
|
||
task snippy_core { | ||
input { | ||
Array[File] snippy_variants_outdir_tarball | ||
Array[String] samplenames | ||
String tree_name | ||
String docker = "staphb/snippy:4.6.0" | ||
File reference | ||
File? bed_file | ||
} | ||
command <<< | ||
# version control | ||
snippy --version | head -1 | tee VERSION | ||
|
||
tarball_array=(~{sep=" " snippy_variants_outdir_tarball}) | ||
samplename_array=(~{sep=" " samplenames}) | ||
|
||
# iteratively untar | ||
for i in ${tarball_array[@]}; do tar -xf $i; done | ||
|
||
# run snippy core | ||
snippy-core \ | ||
--prefix ~{tree_name} \ | ||
~{'--mask ' + bed_file} \ | ||
--ref ~{reference} \ | ||
"${samplename_array[@]}" | ||
|
||
# run snippy clean | ||
snippy-clean_full_aln \ | ||
~{tree_name}.full.aln > ~{tree_name}_snippy_clean_full.aln | ||
|
||
mv ~{tree_name}.aln ~{tree_name}_core.aln | ||
mv ~{tree_name}.full.aln ~{tree_name}_full.aln | ||
mv ~{tree_name}.tab ~{tree_name}_all_snps.tsv | ||
mv ~{tree_name}.txt ~{tree_name}_snps_summary.txt | ||
>>> | ||
output { | ||
String snippy_version = read_string("VERSION") | ||
File snippy_core_alignment = "~{tree_name}_core.aln" | ||
File snippy_full_alignment = "~{tree_name}_full.aln" | ||
File snippy_full_alignment_clean = "~{tree_name}_snippy_clean_full.aln" | ||
File snippy_ref = "~{tree_name}.ref.fa" | ||
File snippy_core_tab = "~{tree_name}_all_snps.tsv" | ||
File snippy_txt = "~{tree_name}_snps_summary.txt" | ||
File snippy_vcf = "~{tree_name}.vcf" | ||
String snippy_docker_image = docker | ||
} | ||
runtime { | ||
docker: "~{docker}" | ||
memory: "8 GB" | ||
cpu: 4 | ||
disks: "local-disk 100 SSD" | ||
preemptible: 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.