Skip to content

Commit

Permalink
Matrix table fix (#7)
Browse files Browse the repository at this point in the history
* fix gubbins error with 2 isolates

* clean spaces

* use run gubbins boolean

* clean white space
  • Loading branch information
taranewman authored Apr 10, 2024
1 parent 2f51d61 commit 94f88ad
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
13 changes: 10 additions & 3 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,24 @@ workflow {
ch_mask = Channel.fromPath(params.mask)
}



main:

snippy_core(ch_snippy_dirs.collect().combine(ch_ref).map{ it -> [it[0..-2], it[-1]] }.combine(ch_mask))


if (!params.skip_gubbins) {
gubbins(snippy_core.out.clean_full_alignment)
ch_alignment = gubbins.out.filtered_polymorphic_sites
gubbins(snippy_core.out.clean_full_alignment, snippy_core.out.run_gubbins)
if (snippy_core.out.run_gubbins == "true") {
ch_alignment = gubbins.out.filtered_polymorphic_sites
} else {
ch_alignment = snippy_core.out.clean_full_alignment
}
} else {
ch_alignment = snippy_core.out.clean_full_alignment
}

snp_sites(ch_alignment)

iqtree(snp_sites.out)
Expand Down
6 changes: 6 additions & 0 deletions modules/gubbins.nf
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
process gubbins {

errorStrategy 'ignore'

publishDir "${params.outdir}", mode: 'copy', pattern: "gubbins.*"

input:
path(alignment)
val(run_gubbins)

output:
path('gubbins.filtered_polymorphic_sites.fasta'), emit: filtered_polymorphic_sites
path('gubbins.recombination_predictions.gff'), emit: recombination_predictions_gff
path('gubbins.per_branch_statistics.tsv'), emit: per_branch_statistics

when:
run_gubbins == "true"

script:
"""
run_gubbins.py \
Expand Down
13 changes: 12 additions & 1 deletion modules/snippy_core.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ process snippy_core {
path('core.tsv'), emit: core_stats
path('core.full.aln'), emit: full_alignment
path('clean.full.aln'), emit: clean_full_alignment
val('run_gubbins'), emit: run_gubbins


script:
"""
Expand All @@ -23,5 +25,14 @@ process snippy_core {
snippy-clean_full_aln core.full.aln > clean.full.aln
add_percent_used.py core.txt > core.tsv
num_isolates=\$(echo "\$snippy_dirs" | tr -s ' ' | wc -w)
if [ "\$num_isolates" -ge 3 ]; then
run_gubbins='true'
else
run_gubbins='false'
fi
"""
}
}

0 comments on commit 94f88ad

Please sign in to comment.