-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apollo_Illumina_PE & kSNP3 workflows (#7)
* Update task_taxon_id.wdl * refine output tsv * increase compure resources * fix formatting * parse module reports to grab relevant outputs * change local dev workflow name * write to predicted taxon; format delta to two decimal places * fix syntax * print info for failed species predictions * print info for failed species predictions * print info for failed species predictions * fix syntax * update no-call message * split taxon to genus and species * write no-calls out as string * fix typo * rename to apollo * add ksnp3 workflow * Switch to gambit naming * Fix file path * fix typo * fix typo
- Loading branch information
1 parent
4d0cb0f
commit 9a29872
Showing
5 changed files
with
155 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
version 1.0 | ||
|
||
task ksnp3 { | ||
|
||
input { | ||
Array[File] assembly_fasta | ||
Array[String] samplename | ||
String cluster_name | ||
Int kmer_size = 19 | ||
String docker_image = "staphb/ksnp3:3.1" | ||
Int mem_size_gb = 8 | ||
Int CPUs = 4 | ||
} | ||
|
||
command <<< | ||
|
||
assembly_array=(~{sep=' ' assembly_fasta}) | ||
assembly_array_len=$(echo "${#assembly_array[@]}") | ||
samplename_array=(~{sep=' ' samplename}) | ||
samplename_array_len=$(echo "${#samplename_array[@]}") | ||
|
||
# Ensure assembly, and samplename arrays are of equal length | ||
if [ "$assembly_array_len" -ne "$samplename_array_len" ]; then | ||
echo "Assembly array (length: $assembly_array_len) and samplename array (length: $samplename_array_len) are of unequal length." >&2 | ||
exit 1 | ||
fi | ||
|
||
# create file of filenames for kSNP3 input | ||
date | ||
|
||
touch ksnp3_input.tsv | ||
for index in ${!assembly_array[@]}; do | ||
assembly=${assembly_array[$index]} | ||
samplename=${samplename_array[$index]} | ||
|
||
echo -e "${assembly}\t${samplename}" >> ksnp3_input.tsv | ||
done | ||
|
||
kSNP3 -in ksnp3_input.tsv -outdir ksnp3 -k ~{kmer_size} -core | ||
|
||
mv ksnp3/core_SNPs_matrix.fasta ~{cluster_name}_core_SNPs_matrix.fasta | ||
mv ksnp3/tree.core.tre ~{cluster_name}_core.tree | ||
|
||
>>> | ||
|
||
output { | ||
File ksnp3_matrix = "${cluster_name}_core_SNPs_matrix.fasta" | ||
File ksnp3_tree = "${cluster_name}_core.tree" | ||
String ksnp3_docker_image = docker_image | ||
|
||
} | ||
|
||
runtime { | ||
docker: docker_image | ||
memory: "~{mem_size_gb} GB" | ||
cpu: CPUs | ||
disks: "local-disk 100 SSD" | ||
preemptible: 0 | ||
} | ||
} | ||
|
||
task snp_dists { | ||
|
||
input { | ||
File alignment | ||
String cluster_name | ||
} | ||
|
||
command{ | ||
# date and version control | ||
date | tee DATE | ||
snp-dists -v | tee VERSION | ||
|
||
snp-dists ${alignment} > ${cluster_name}_snp_distance_matrix.tsv | ||
|
||
} | ||
|
||
output { | ||
String date = read_string("DATE") | ||
String version = read_string("VERSION") | ||
File snp_matrix = "${cluster_name}_snp_distance_matrix.tsv" | ||
} | ||
|
||
runtime { | ||
docker: "staphb/snp-dists:0.6.2" | ||
memory: "2 GB" | ||
cpu: 2 | ||
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
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,28 @@ | ||
version 1.0 | ||
|
||
import "../tasks/task_phylo.wdl" as phylo | ||
|
||
workflow ksnp3 { | ||
input { | ||
Array[File] assembly_fasta | ||
Array[String] samplename | ||
String cluster_name | ||
} | ||
call phylo.ksnp3 as ksnp3_task { | ||
input: | ||
assembly_fasta=assembly_fasta, | ||
samplename=samplename, | ||
cluster_name=cluster_name | ||
} | ||
call phylo.snp_dists { | ||
input: | ||
cluster_name = cluster_name, | ||
alignment = ksnp3_task.ksnp3_matrix | ||
} | ||
|
||
output { | ||
File snp_matrix = snp_dists.snp_matrix | ||
File ksnp3_tree = ksnp3_task.ksnp3_tree | ||
String ksnp3_docker = ksnp3_task.ksnp3_docker_image | ||
} | ||
} |