diff --git a/conf/modules.config b/conf/modules.config index 1abb67ca..4ef1befa 100755 --- a/conf/modules.config +++ b/conf/modules.config @@ -418,6 +418,22 @@ process { ] } + withName: SKA2 { + publishDir = [ + path: { "${params.outdir}/recombination/ska2" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: GUBBINS { + publishDir = [ + path: { "${params.outdir}/recombination/gubbins/${cluster}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + withName: MULTIQC { publishDir = [ diff --git a/modules/local/ska.nf b/modules/local/ska.nf index b16bcf9a..6c6e7880 100644 --- a/modules/local/ska.nf +++ b/modules/local/ska.nf @@ -1,14 +1,14 @@ -process SKA { +process SKA2 { tag "$cluster" label 'process_medium' conda "bioconda::gubbins=3.3.0" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gubbins:3.3.0--py310pl5321h8472f5a_0': - 'quay.io/biocontainers/gubbins:3.3.0--py310pl5321h8472f5a_0' }" + 'docker://jvfe/gubbins:3.3.0': + 'docker.io/jvfe/gubbins:3.3.0' }" input: - tuple val(cluster), path(assemblies), path(reference) + tuple val(cluster), path(assemblies), val(reference) path assembly_files output: diff --git a/modules/nf-core/gubbins/main.nf b/modules/nf-core/gubbins/main.nf index 08448161..d64c58d9 100644 --- a/modules/nf-core/gubbins/main.nf +++ b/modules/nf-core/gubbins/main.nf @@ -7,7 +7,7 @@ process GUBBINS { 'quay.io/biocontainers/gubbins:3.0.0--py39h5bf99c6_0' }" input: - path alignment + tuple val(cluster), path(alignment) output: path "*.fasta" , emit: fasta @@ -29,6 +29,7 @@ process GUBBINS { """ run_gubbins.py \\ --threads $task.cpus \\ + --prefix cluster_$cluster \\ $args \\ $alignment cat <<-END_VERSIONS > versions.yml diff --git a/nextflow.config b/nextflow.config index b6d019bf..6152cf62 100755 --- a/nextflow.config +++ b/nextflow.config @@ -48,6 +48,8 @@ params { // Recombination run_recombination = false + run_verticall = true + run_gubbins = false // MultiQC options multiqc_config = null diff --git a/nextflow_schema.json b/nextflow_schema.json index 2daf538a..fa517df6 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -209,6 +209,15 @@ "type": "boolean", "description": "Run Recombination", "fa_icon": "fas fa-tree" + }, + "run_verticall": { + "type": "boolean", + "default": true, + "description": "Run Verticall recombination tool" + }, + "run_gubbins": { + "type": "boolean", + "description": "Run Gubbins recombination tool" } } }, diff --git a/recombination.nf b/recombination.nf index 96b0a516..eb43c1bc 100644 --- a/recombination.nf +++ b/recombination.nf @@ -1,6 +1,8 @@ include { GET_RECOMB_INPUT } from './modules/local/get_recomb_input' include { VERTICALL_PAIRWISE } from './modules/local/verticall/pairwise.nf' +include { SKA2 } from './modules/local/ska' include { QUAST } from './modules/nf-core/quast/main' +include { GUBBINS } from './modules/nf-core/gubbins/main' workflow { @@ -52,19 +54,22 @@ workflow { .map { row -> tuple(row.Cluster, file(row.samplesheet), row.Reference, row.reference_path) } .set { recomb_input } - assemblies - .combine (recomb_input.map { c,s,ref,reffile -> ref } | collect | map { [it] }) - .filter { meta, path, to_remove -> !(meta["id"] in to_remove) } - .map { it[0, 1] } - .collect { meta, path -> path } - .set { unduplicated_assemblies } - - VERTICALL_PAIRWISE ( - recomb_input.map { c, s, r, rf -> tuple(c,s,rf) }, - assemblies.collect { meta, path -> path } - ) - - + if (params.run_gubbins) { + SKA2 ( + recomb_input.map { c, s, r, rf -> tuple(c,s,rf) }, + assemblies.collect { meta, path -> path } + ) + + GUBBINS ( + SKA2.out.aln + ) + } + if (params.run_verticall) { + VERTICALL_PAIRWISE ( + recomb_input.map { c, s, r, rf -> tuple(c,s,rf) }, + assemblies.collect { meta, path -> path } + ) + } // emit: // genomes_to_remove = genomes_to_remove diff --git a/subworkflows/local/recombination.nf b/subworkflows/local/recombination.nf index 0abce387..4a3e00e6 100644 --- a/subworkflows/local/recombination.nf +++ b/subworkflows/local/recombination.nf @@ -1,6 +1,8 @@ include { GET_RECOMB_INPUT } from '../../modules/local/get_recomb_input' include { VERTICALL_PAIRWISE } from '../../modules/local/verticall/pairwise.nf' +include { SKA2 } from '../../modules/local/ska' include { QUAST } from '../../modules/nf-core/quast/main' +include { GUBBINS } from '../../modules/nf-core/gubbins/main' workflow RECOMBINATION { @@ -41,20 +43,27 @@ workflow RECOMBINATION { .map { row -> tuple(row.Cluster, file(row.samplesheet), row.Reference, row.reference_path) } .set { recomb_input } - assemblies - .combine (recomb_input.map { c,s,ref,reffile -> ref } | collect | map { [it] }) - .filter { meta, path, to_remove -> !(meta["id"] in to_remove) } - .map { it[0, 1] } - .collect { meta, path -> path } - .set { unduplicated_assemblies } - - VERTICALL_PAIRWISE ( - recomb_input.map { c, s, r, rf -> tuple(c,s,rf) }, - assemblies.collect { meta, path -> path } - ) + if (params.run_gubbins) { + SKA2 ( + recomb_input.map { c, s, r, rf -> tuple(c,s,rf) }, + assemblies.collect { meta, path -> path } + ) + GUBBINS ( + SKA2.out.aln + ) + } + if (params.run_verticall) { + VERTICALL_PAIRWISE ( + recomb_input.map { c, s, r, rf -> tuple(c,s,rf) }, + assemblies.collect { meta, path -> path } + ) + } + verticall_result = VERTICALL_PAIRWISE.out.tsv.ifEmpty([]) + gubbins_result = GUBBINS.out.stats.ifEmpty([]) emit: - verticall_result = VERTICALL_PAIRWISE.out.tsv + verticall_result + gubbins_result }