1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-11-22 23:19:54 +00:00

Merge pull request #126 from nf-core/kaiju2table-move

Kaiju2table move
This commit is contained in:
James A. Fellows Yates 2022-09-08 13:21:27 +02:00 committed by GitHub
commit 74c164bbcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 23 deletions

View file

@ -268,7 +268,7 @@ process {
// one run with multiple samples, so fix ID to just db name to ensure clean log name // one run with multiple samples, so fix ID to just db name to ensure clean log name
ext.prefix = { "${meta.db_name}" } ext.prefix = { "${meta.db_name}" }
publishDir = [ publishDir = [
path: { "${params.outdir}/malt/${meta.db_name}" }, path: { "${params.outdir}/malt/${meta.db_name}/" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
pattern: '*.{rma6,log,sam}' pattern: '*.{rma6,log,sam}'
] ]
@ -278,7 +278,7 @@ process {
ext.args = "-c2c Taxonomy" ext.args = "-c2c Taxonomy"
ext.prefix = { "${meta.id}" } ext.prefix = { "${meta.id}" }
publishDir = [ publishDir = [
path: { "${params.outdir}/malt/${meta.db_name}" }, path: { "${params.outdir}/malt/${meta.db_name}/" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
pattern: '*.{txt.gz,megan}' pattern: '*.{txt.gz,megan}'
] ]
@ -288,7 +288,7 @@ process {
ext.args = { "${meta.db_params}" } ext.args = { "${meta.db_params}" }
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" } ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
publishDir = [ publishDir = [
path: { "${params.outdir}/kraken2/${meta.db_name}" }, path: { "${params.outdir}/kraken2/${meta.db_name}/" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
pattern: '*.{txt,report,fastq.gz}' pattern: '*.{txt,report,fastq.gz}'
] ]
@ -297,7 +297,7 @@ process {
withName: KRONA_CLEANUP { withName: KRONA_CLEANUP {
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" } ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
publishDir = [ publishDir = [
path: { "${params.outdir}/krona" }, path: { "${params.outdir}/krona/" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
pattern: '*.{html}' pattern: '*.{html}'
] ]
@ -306,7 +306,7 @@ process {
withName: KRONA_KTIMPORTTEXT { withName: KRONA_KTIMPORTTEXT {
ext.prefix = { "${meta.tool}-${meta.id}" } ext.prefix = { "${meta.tool}-${meta.id}" }
publishDir = [ publishDir = [
path: { "${params.outdir}/krona" }, path: { "${params.outdir}/krona/" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
pattern: '*.{html}' pattern: '*.{html}'
] ]
@ -321,7 +321,7 @@ process {
ext.args = "-i" ext.args = "-i"
ext.prefix = { "${meta.tool}-${meta.id}" } ext.prefix = { "${meta.tool}-${meta.id}" }
publishDir = [ publishDir = [
path: { "${params.outdir}/krona" }, path: { "${params.outdir}/krona/" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
pattern: '*.{html}' pattern: '*.{html}'
] ]
@ -331,7 +331,7 @@ process {
ext.args = { "${meta.db_params}" } ext.args = { "${meta.db_params}" }
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" } ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
publishDir = [ publishDir = [
path: { "${params.outdir}/metaphlan3/${meta.db_name}" }, path: { "${params.outdir}/metaphlan3/${meta.db_name}/" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
pattern: '*.{biom,txt}' pattern: '*.{biom,txt}'
] ]
@ -339,7 +339,7 @@ process {
withName: CENTRIFUGE_CENTRIFUGE { withName: CENTRIFUGE_CENTRIFUGE {
publishDir = [ publishDir = [
path: { "${params.outdir}/centrifuge/${meta.db_name}" }, path: { "${params.outdir}/centrifuge/${meta.db_name}/" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
pattern: '*.{txt,sam,gz}' pattern: '*.{txt,sam,gz}'
] ]
@ -352,27 +352,26 @@ process {
ext.args = { "${meta.db_params}" } ext.args = { "${meta.db_params}" }
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}.centrifuge" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}.centrifuge" } ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}.centrifuge" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}.centrifuge" }
publishDir = [ publishDir = [
path: { "${params.outdir}/centrifuge/${meta.db_name}" }, path: { "${params.outdir}/centrifuge/${meta.db_name}/" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
pattern: '*.{txt}' pattern: '*.{txt}'
] ]
} }
withName: KAIJU_KAIJU { withName: KAIJU_KAIJU {
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
publishDir = [ publishDir = [
path: { "${params.outdir}/kaiju/${meta.db_name}" }, path: { "${params.outdir}/kaiju/${meta.db_name}/" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
pattern: '*.tsv' pattern: '*.tsv'
] ]
ext.args = { "${meta.db_params}" } ext.args = { "${meta.db_params}" }
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
} }
withName: KAIJU_KAIJU2TABLE { withName: KAIJU_KAIJU2TABLE {
ext.args = { "${meta.db_params}" } ext.prefix = { "${meta.id}_combined_reports" }
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
publishDir = [ publishDir = [
path: { "${params.outdir}/kaiju/${meta.db_name}" }, path: { "${params.outdir}/kaiju/" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
pattern: '*.{txt}' pattern: '*.{txt}'
] ]
@ -386,7 +385,7 @@ process {
ext.args = { "${meta.db_params}" } ext.args = { "${meta.db_params}" }
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" } ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
publishDir = [ publishDir = [
path: { "${params.outdir}/diamond/${meta.db_name}" }, path: { "${params.outdir}/diamond/${meta.db_name}/" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
pattern: '*.{blast,xml,txt,daa,sam,tsv,paf,log}' pattern: '*.{blast,xml,txt,daa,sam,tsv,paf,log}'
] ]
@ -395,7 +394,7 @@ process {
withName: MOTUS_PROFILE { withName: MOTUS_PROFILE {
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" } ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
publishDir = [ publishDir = [
path: { "${params.outdir}/motus/${meta.db_name}" }, path: { "${params.outdir}/motus/${meta.db_name}/" },
mode: params.publish_dir_mode mode: params.publish_dir_mode
] ]
} }

View file

@ -12,7 +12,7 @@
params { params {
config_profile_name = 'Test profile' config_profile_name = 'Test profile'
config_profile_description = 'Minimal test dataset without performing any preprocessing nor profiling to check pipeline function. Useful when you only wish to test a single profiler without having to 'opt-out' of all the others' config_profile_description = 'Minimal test dataset without performing any preprocessing nor profiling to check pipeline function. Useful when you only wish to test a single profiler without having to opt-out of all the others'
// Limit resources so that this can run on GitHub Actions // Limit resources so that this can run on GitHub Actions
max_cpus = 2 max_cpus = 2

View file

@ -9,7 +9,6 @@ include { CENTRIFUGE_CENTRIFUGE } from '../../modules/nf-core/mo
include { CENTRIFUGE_KREPORT } from '../../modules/nf-core/modules/centrifuge/kreport/main' include { CENTRIFUGE_KREPORT } from '../../modules/nf-core/modules/centrifuge/kreport/main'
include { METAPHLAN3 } from '../../modules/nf-core/modules/metaphlan3/main' include { METAPHLAN3 } from '../../modules/nf-core/modules/metaphlan3/main'
include { KAIJU_KAIJU } from '../../modules/nf-core/modules/kaiju/kaiju/main' include { KAIJU_KAIJU } from '../../modules/nf-core/modules/kaiju/kaiju/main'
include { KAIJU_KAIJU2TABLE } from '../../modules/nf-core/modules/kaiju/kaiju2table/main'
include { DIAMOND_BLASTX } from '../../modules/nf-core/modules/diamond/blastx/main' include { DIAMOND_BLASTX } from '../../modules/nf-core/modules/diamond/blastx/main'
include { MOTUS_PROFILE } from '../../modules/nf-core/modules/motus/profile/main' include { MOTUS_PROFILE } from '../../modules/nf-core/modules/motus/profile/main'
@ -185,11 +184,8 @@ workflow PROFILING {
} }
KAIJU_KAIJU ( ch_input_for_kaiju.reads, ch_input_for_kaiju.db) KAIJU_KAIJU ( ch_input_for_kaiju.reads, ch_input_for_kaiju.db)
KAIJU_KAIJU2TABLE (KAIJU_KAIJU.out.results, ch_input_for_kaiju.db, params.kaiju_taxon_rank)
ch_multiqc_files = ch_multiqc_files.mix( KAIJU_KAIJU2TABLE.out.summary )
ch_versions = ch_versions.mix( KAIJU_KAIJU.out.versions.first() ) ch_versions = ch_versions.mix( KAIJU_KAIJU.out.versions.first() )
ch_raw_classifications = ch_raw_classifications.mix( KAIJU_KAIJU.out.results ) ch_raw_classifications = ch_raw_classifications.mix( KAIJU_KAIJU.out.results )
ch_raw_profiles = ch_raw_profiles.mix( KAIJU_KAIJU2TABLE.out.summary )
} }

View file

@ -1,7 +1,8 @@
// //
// Create Krona visualizations // Standardise output files e.g. aggregation
// //
include { KAIJU_KAIJU2TABLE } from '../../modules/nf-core/modules/kaiju/kaiju2table/main'
include { MOTUS_MERGE } from '../../modules/nf-core/modules/motus/merge/main' include { MOTUS_MERGE } from '../../modules/nf-core/modules/motus/merge/main'
workflow STANDARDISATION_PROFILES { workflow STANDARDISATION_PROFILES {
@ -14,6 +15,7 @@ workflow STANDARDISATION_PROFILES {
main: main:
ch_standardised_tables = Channel.empty() ch_standardised_tables = Channel.empty()
ch_versions = Channel.empty() ch_versions = Channel.empty()
ch_multiqc_files = Channel.empty()
/* /*
Split profile results based on tool they come from Split profile results based on tool they come from
@ -26,12 +28,14 @@ workflow STANDARDISATION_PROFILES {
ch_input_classifications = classifications ch_input_classifications = classifications
.branch { .branch {
kaiju: it[0]['tool'] == 'kaiju'
unknown: true unknown: true
} }
ch_input_databases = databases ch_input_databases = databases
.branch { .branch {
motus: it[0]['tool'] == 'motus' motus: it[0]['tool'] == 'motus'
kaiju: it[0]['tool'] == 'kaiju'
unknown: true unknown: true
} }
@ -39,6 +43,21 @@ workflow STANDARDISATION_PROFILES {
Standardise and aggregate Standardise and aggregate
*/ */
// Kaiju
// Collect and replace id for db_name for prefix
ch_profiles_for_kaiju = ch_input_classifications.kaiju
.map { [it[0]['db_name'], it[1]] }
.groupTuple()
.map {
[[id:it[0]], it[1]]
}
KAIJU_KAIJU2TABLE ( ch_profiles_for_kaiju, ch_input_databases.kaiju.map{it[1]}, params.kaiju_taxon_rank)
ch_standardised_tables = ch_standardised_tables.mix( KAIJU_KAIJU2TABLE.out.summary )
ch_multiqc_files = ch_multiqc_files.mix( KAIJU_KAIJU2TABLE.out.summary )
ch_versions = ch_versions.mix( KAIJU_KAIJU2TABLE.out.versions )
// mOTUs has a 'single' database, and cannot create custom ones. // mOTUs has a 'single' database, and cannot create custom ones.
// Therefore removing db info here, and publish merged at root mOTUs results // Therefore removing db info here, and publish merged at root mOTUs results
// directory // directory
@ -53,4 +72,5 @@ workflow STANDARDISATION_PROFILES {
emit: emit:
tables = ch_standardised_tables tables = ch_standardised_tables
versions = ch_versions versions = ch_versions
mqc = ch_multiqc_files
} }

View file

@ -267,6 +267,10 @@ workflow TAXPROFILER {
ch_multiqc_files = ch_multiqc_files.mix( PROFILING.out.mqc.collect{it[1]}.ifEmpty([]) ) ch_multiqc_files = ch_multiqc_files.mix( PROFILING.out.mqc.collect{it[1]}.ifEmpty([]) )
if ( params.run_profile_standardisation ) {
ch_multiqc_files = ch_multiqc_files.mix( STANDARDISATION_PROFILES.out.mqc.collect{it[1]}.ifEmpty([]) )
}
// TODO create multiQC module for metaphlan // TODO create multiQC module for metaphlan
MULTIQC ( MULTIQC (
ch_multiqc_files.collect() ch_multiqc_files.collect()