Skip to content

Commit

Permalink
feat: Add SKA2 & Gubbins option
Browse files Browse the repository at this point in the history
  • Loading branch information
jvfe committed Jul 16, 2023
1 parent 05748a4 commit 60b4664
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 30 deletions.
16 changes: 16 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
8 changes: 4 additions & 4 deletions modules/local/ska.nf
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
3 changes: 2 additions & 1 deletion modules/nf-core/gubbins/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,6 +29,7 @@ process GUBBINS {
"""
run_gubbins.py \\
--threads $task.cpus \\
--prefix cluster_$cluster \\
$args \\
$alignment
cat <<-END_VERSIONS > versions.yml
Expand Down
2 changes: 2 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ params {

// Recombination
run_recombination = false
run_verticall = true
run_gubbins = false

// MultiQC options
multiqc_config = null
Expand Down
9 changes: 9 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
},
Expand Down
31 changes: 18 additions & 13 deletions recombination.nf
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -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
Expand Down
33 changes: 21 additions & 12 deletions subworkflows/local/recombination.nf
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -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
}

0 comments on commit 60b4664

Please sign in to comment.