Skip to content

Commit 1c5a4da

Browse files
committed
updated file naming for html outputs. Fixed bug with random selection of reference genome
1 parent 06a1ade commit 1c5a4da

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

workflows/Nextflow/modules/SNPtree/SNPtree.nf

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ include {PHYLOSRA} from '../sra2fastq/sra2fastq.nf'
88

99
//prepares control file for phame and runs it with the specified options
1010
process prepareSNPphylogeny {
11+
debug true
1112
label 'phyl'
1213
containerOptions "--bind=${settings["snpDBbase"]}:/venv/bin/database"
1314

@@ -55,7 +56,12 @@ process prepareSNPphylogeny {
5556
def db = settings["snpDBname"] != null ? "-db ${settings["snpDBname"]}" : ""
5657
def genomeNames = settings["snpGenomes"].size() != 0 ? "-genomesList ${settings["snpGenomes"].join(",")}" : ""
5758
def genomeFiles = settings["snpGenomesFiles"].size() != 0 ? "-genomesFiles ${settings["snpGenomesFiles"].join(",")}" : ""
58-
def reference = settings["snpRefGenome"] != null ? "-reference ${settings["snpRefGenome"]}" : ""
59+
reference = settings["snpRefGenome"] != null ? "-reference ${settings["snpRefGenome"]}" : ""
60+
if(settings["snpRefGenome"].equalsIgnoreCase("random")) {
61+
randomOrderGenomes = settings["snpGenomesFiles"].plus(settings["snpGenomes"])
62+
randomOrderGenomes.shuffle()
63+
reference = "-reference ${randomOrderGenomes[0]}"
64+
}
5965
def pair = paired.name != "NO_FILE" ? "-p $paired" : ""
6066
def single = unpaired.name != "NO_FILE2" ? "-s $unpaired" : ""
6167
def contig = contigs.name != "NO_FILE3" ? "-c $contigs" : ""
@@ -133,7 +139,16 @@ process visualizePhylogenyHTML {
133139

134140
publishDir(
135141
path: "${settings["phylogenyOutDir"]}",
136-
mode: 'copy'
142+
mode: 'copy',
143+
saveAs: {
144+
filename ->
145+
if(filename.endsWith("_cds.fasttree.html") || filename.endsWith("cds.html")) {
146+
"SNPphyloTree.cds.html"
147+
}
148+
else if(filename.endsWith("fasttree.html")|| filename.endsWith("all.html")) {
149+
"SNPphyloTree.all.html"
150+
}
151+
}
137152
)
138153

139154
input:

0 commit comments

Comments
 (0)