From c51d8564f577875e083830801b6459eb958849b7 Mon Sep 17 00:00:00 2001 From: HNHalstead <47102761+HNHalstead@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:26:52 -0800 Subject: [PATCH] editing to include cluster name in output when provided --- tasks/utilities/task_utilities.wdl | 10 +++++++++- workflows/phylogenetics/wf_RECAPP_waphl.wdl | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tasks/utilities/task_utilities.wdl b/tasks/utilities/task_utilities.wdl index 41390cb2e..2b95255cc 100644 --- a/tasks/utilities/task_utilities.wdl +++ b/tasks/utilities/task_utilities.wdl @@ -230,8 +230,9 @@ task split_by_declared_cluster { cluster_list = "~{sep=' ' declared_cluster}".split(" ") seqs = "~{sep=' ' samplename}".split(" ") out = "~{cluster_name}_output.txt" + clust_out = "~{cluster_name}_clusters.txt" - + clust_dict = {} for i in range(len(seqs)): if not cluster_list[i]: @@ -252,12 +253,19 @@ task split_by_declared_cluster { fp.write("\n") print('Done') + with open(clust_out, 'w') as fp: + for li in clust_dict.keys(): + fp.write("%s\n" % item) + #fp.write("\n") + print('Done') + CODE >>> output { String date = read_string("DATE") File clade_list_file = "~{cluster_name}_output.txt" Array[Array[String]] clade_list = read_tsv("~{cluster_name}_output.txt") + Array[Array[String]] unique_clusters = read_tsv("~{cluster_name}_clusters.txt") String split_cluster_docker_image = docker } runtime { diff --git a/workflows/phylogenetics/wf_RECAPP_waphl.wdl b/workflows/phylogenetics/wf_RECAPP_waphl.wdl index 579d305b0..2c6f8dd3f 100644 --- a/workflows/phylogenetics/wf_RECAPP_waphl.wdl +++ b/workflows/phylogenetics/wf_RECAPP_waphl.wdl @@ -94,13 +94,13 @@ if (defined(declared_cluster)) { } } -scatter (pair in zip(select_first([split_by_declared_cluster.clade_list, split_by_clade.clade_list]), range(length(select_first([split_by_declared_cluster.clade_list, split_by_clade.clade_list]))))) { +scatter (pair in zip(select_first([split_by_declared_cluster.clade_list, split_by_clade.clade_list]), select_first([split_by_declared_cluster.unique_clusters, range(length(split_by_clade.clade_list))]))) { if (length(select_all(pair.left)) >= 3){ call utilities.scatter_by_clade as scatter_by_clade { input: clade_list = pair.left, cluster_name = cluster_name, - assembly_files = assembly_gff + assembly_files = assembly_gff, } call clade_analysis.clade_analysis as clade_analysis {