Skip to content

Commit

Permalink
feat: Implement microview into taxonomy subwf (#33)
Browse files Browse the repository at this point in the history
* feat: Add MicroView module

* refactor: Allow mixing kaiju and kraken results

* chore: Remove hidden default logo param
  • Loading branch information
jvfe authored Mar 31, 2024
1 parent 6ab04ad commit 86ab63f
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 6 deletions.
7 changes: 7 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ process {
]
}

withName: MICROVIEW {
publishDir = [
path: { "${params.outdir}/taxonomy/microview" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: MEGAHIT {
publishDir = [
Expand Down
1 change: 1 addition & 0 deletions docs/params.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Choose to skip pipeline steps
| `skip_alignment` | Skip alignment | `boolean` | | | |
| `skip_functional` | Skip functional annotation | `boolean` | | | |
| `skip_host_removal` | Skip host removal | `boolean` | | | |
| `skip_microview` | Skip MicroView report | `boolean` | | | |

## Decontamination

Expand Down
43 changes: 43 additions & 0 deletions modules/local/microview.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
process MICROVIEW {
tag 'report'
label 'process_low'

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'docker://docker.io/jvfe/microview:v0.10.0':
'docker.io/jvfe/microview:v0.10.0' }"

input:
path reports

output:
path "microview_report.html", emit: report
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
"""
microview \\
--taxonomy . \\
--output microview_report.html
cat <<-END_VERSIONS > versions.yml
"${task.process}":
MicroView: \$(microview --version | sed 's/.*version \\([0-9.]\\+\\).*/\\1/')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''

"""
touch microview_report.html
cat <<-END_VERSIONS > versions.yml
"${task.process}":
MicroView: \$(microview --version | sed 's/.*version \\([0-9.]\\+\\).*/\\1/')
END_VERSIONS
"""
}
1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ params {
skip_classification = false
skip_functional = false
skip_alignment = false
skip_microview = false

// MultiQC options
multiqc_config = null
Expand Down
5 changes: 5 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
"type": "boolean",
"description": "Skip host removal",
"fa_icon": "fab fa-ioxhost"
},
"skip_microview": {
"type": "boolean",
"fa_icon": "fas fa-glasses",
"description": "Skip MicroView report"
}
},
"fa_icon": "fas fa-angle-double-right"
Expand Down
21 changes: 16 additions & 5 deletions subworkflows/local/taxonomy.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ include { KAIJU_KAIJU2TABLE } from '../../modules/nf-core/kaiju/kaiju2table/main
include { KAIJU_KAIJU2KRONA } from '../../modules/nf-core/kaiju/kaiju2krona/main'
include { KRONA_KTIMPORTTEXT } from '../../modules/nf-core/krona/ktimporttext/main'

include { MICROVIEW } from '../../modules/local/microview.nf'

workflow TAXONOMY {
take:
reads
Expand All @@ -14,6 +16,8 @@ workflow TAXONOMY {

main:

tax_report = Channel.empty()
krona_input = Channel.empty()
ch_versions = Channel.empty()

if (params.run_kaiju) {
Expand All @@ -33,10 +37,10 @@ workflow TAXONOMY {
"species"
)

KAIJU_KAIJU2TABLE.out.summary.set { tax_report }
tax_report = tax_report.mix(KAIJU_KAIJU2TABLE.out.summary)

KAIJU_KAIJU2KRONA (kaiju_out, kaiju_db_files)
KAIJU_KAIJU2KRONA.out.txt.set { krona_input }
krona_input = krona_input.mix(KAIJU_KAIJU2KRONA.out.txt)
ch_versions = ch_versions.mix(KAIJU_KAIJU2KRONA.out.versions)
}

Expand All @@ -47,17 +51,24 @@ workflow TAXONOMY {
false,
false
)
KRAKEN2_KRAKEN2.out.report.set { tax_report }
tax_report = tax_report.mix(KRAKEN2_KRAKEN2.out.report)
ch_versions = ch_versions.mix(KRAKEN2_KRAKEN2.out.versions.first())

KRAKENTOOLS_KREPORT2KRONA (
tax_report
KRAKEN2_KRAKEN2.out.report
)
KRAKENTOOLS_KREPORT2KRONA.out.txt.set { krona_input }
krona_input = krona_input.mix(KRAKENTOOLS_KREPORT2KRONA.out.txt)
ch_versions = ch_versions.mix(KRAKENTOOLS_KREPORT2KRONA.out.versions.first())
}


if (!params.skip_microview) {
MICROVIEW (
tax_report.collect{it[1]}
)
ch_versions = ch_versions.mix(MICROVIEW.out.versions)
}

KRONA_KTIMPORTTEXT (krona_input)
ch_versions = ch_versions.mix(KRONA_KTIMPORTTEXT.out.versions)

Expand Down
2 changes: 1 addition & 1 deletion workflows/euryale.nf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ch_multiqc_custom_methods_description = params.multiqc_methods_description ? fil
// MODULES
//
include { FASTX_COLLAPSER } from '../modules/local/fastx_toolkit/collapser'
include { MICROVIEW } from '../modules/local/microview.nf'

//
// SUBWORKFLOW: Consisting of a mix of local and nf-core/modules
Expand Down Expand Up @@ -167,7 +168,6 @@ workflow EURYALE {
ch_multiqc_files = ch_multiqc_files.mix(TAXONOMY.out.tax_report.collect{it[1]}.ifEmpty([]))
}


if (!params.skip_functional && !params.skip_alignment) {
FUNCTIONAL (
alignments,
Expand Down

0 comments on commit 86ab63f

Please sign in to comment.