diff --git a/modules/fastani.nf b/modules/fastani.nf index 58ac9c3..145b415 100644 --- a/modules/fastani.nf +++ b/modules/fastani.nf @@ -47,6 +47,6 @@ process fastani { cat fastani/!{sample}.txt | sed 's/,//g' | sed 's/!{genomes}\\///g' | tr "\\t" "," | awk -v sample=!{sample} '{ print sample "," $0 }' >> fastani/!{sample}_fastani.csv top_hit=$(head -n 2 fastani/!{sample}_fastani.csv | tail -n 1 | cut -f 3 -d , ) - if [ -f "$top_hit" ]; then mkdir -p top_hit ; cp $top_hit top_hit/. ; fi + if [ -f "!{genomes}/$top_hit" ]; then mkdir -p top_hit ; cp !{genomes}/$top_hit top_hit/. ; fi ''' } diff --git a/subworkflows/phylogenetic_analysis.nf b/subworkflows/phylogenetic_analysis.nf index 46d0cc3..826b813 100644 --- a/subworkflows/phylogenetic_analysis.nf +++ b/subworkflows/phylogenetic_analysis.nf @@ -14,12 +14,12 @@ workflow phylogenetic_analysis { for_prokka = Channel.empty() if (params.extras) { ch_top_hit - .map { it -> tuple( it[0] , [ it[1].split("/")[1].split("_")[0], it[1].split("/")[1].split("_")[1]] )} + .map { it -> tuple( it[0] , [ it[1].split("_")[0], it[1].split("_")[1]] )} .set { ch_organism } if ( params.fastani_include ) { ch_top_hit - .map { it -> tuple( it[1].split("/")[1].split("_", 3)[2].replaceAll(~/.fna/,""), it[2], it[1].split("/")[1].split("_")[0, 1]) } + .map { it -> tuple( it[1].split("_", 3)[2].replaceAll(~/.fna/,""), it[2], it[1].split("_")[0, 1]) } .groupTuple(by: 0) .map { it -> tuple( it[0], it[1][0], it[2][0] ) } .unique()