Skip to content

Commit

Permalink
Merge pull request #51 from alxndrdiaz/module_parameters
Browse files Browse the repository at this point in the history
add module parameters
  • Loading branch information
jfy133 authored Dec 20, 2024
2 parents 0d56563 + 8c7c803 commit 5b5fcda
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 123 deletions.
41 changes: 32 additions & 9 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ process {
publishDir = [
path: { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
]

withName: 'MULTIQC' {
ext.args = { params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' }

withName: MULTIQC {
ext.args = { params.multiqc_title ? "--title \"${params.multiqc_title}\"" : '' }
publishDir = [
path: { "${params.outdir}/multiqc" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
]
}

Expand All @@ -34,7 +33,7 @@ process {
path: { "${params.outdir}/cat" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.save_concatenated_fastas
enabled: params.save_concatenated_fastas,
]
}

Expand All @@ -44,15 +43,39 @@ process {
path: { "${params.outdir}/cat" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
enabled: params.save_concatenated_fastas
enabled: params.save_concatenated_fastas,
]
}

withName: BRACKEN_BUILD {
ext.args = { "${params.bracken_build_params}" }
}

withName: CENTRIFUGE_BUILD {
ext.args = { "${params.centrifuge_build_params}" }
}

withName: DIAMOND_MAKEDB {
ext.args = { "${params.diamond_build_params}" }
}

withName: GANON_BUILD {
ext.args = { "--verbose" }
ext.args = { "${params.ganon_build_params}" }
}

withName: KAIJU_MKFMI {
ext.args = { "${params.kaiju_build_params}" }
}

withName: KRAKEN2_BUILD {
ext.args = { "${params.kraken2_build_params}" }
}

withName: KRAKENUNIQ_BUILD {
ext.args = { "${params.krakenuniq_build_params}" }
}

withName: MALT_BUILD {
ext.args = { "--sequenceType ${params.malt_sequencetype}" }
ext.args = { "${params.malt_build_params}" }
}
}
7 changes: 4 additions & 3 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ process {
resourceLimits = [
cpus: 4,
memory: '15.GB',
time: '1.h'
time: '1.h',
]
}

Expand All @@ -38,6 +38,8 @@ params {
build_kraken2 = true
build_krakenuniq = true

krakenuniq_build_params = "--work-on-disk --max-db-size 14 --kmer-len 15 --minimizer-len 13 --jellyfish-bin \"\$(which jellyfish)\""

accession2taxid = params.pipelines_testdata_base_path + 'createtaxdb/data/taxonomy/nucl_gb.accession2taxid'
nucl2taxid = params.pipelines_testdata_base_path + 'createtaxdb/data/taxonomy/nucl2tax.map'
prot2taxid = params.pipelines_testdata_base_path + 'createtaxdb/data/taxonomy/prot.accession2taxid.gz'
Expand All @@ -48,7 +50,6 @@ params {

process {
withName: KRAKENUNIQ_BUILD {
memory = { 12.GB * task.attempt }
ext.args = '--work-on-disk --max-db-size 14 --kmer-len 15 --minimizer-len 13 --jellyfish-bin $(which jellyfish)'
memory = { 12.GB * task.attempt }
}
}
15 changes: 11 additions & 4 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,22 @@ params {

// tool specific options
build_bracken = false
build_centrifuge = false
build_diamond = false
build_ganon = false
build_kaiju = false
build_malt = false
build_centrifuge = false
build_kraken2 = false
kraken2_keepintermediate = false
build_krakenuniq = false
build_malt = false
malt_sequencetype = "DNA"
bracken_build_params = ''
centrifuge_build_params = ''
diamond_build_params = ''
ganon_build_params = ''
kaiju_build_params = ''
kraken2_build_params = ''
krakenuniq_build_params = ''
malt_build_params = "--sequenceType DNA"
}

// Load base.config by default for all pipelines
Expand Down Expand Up @@ -261,7 +268,7 @@ manifest {
],
[
name: 'Alexander Ramos Díaz',
affiliation: 'Solena, Leon, Mexico',
affiliation: '',
email: '',
github: 'https://github.com/alxndrdiaz',
contribution: ['contributor'],
Expand Down
53 changes: 47 additions & 6 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,31 +113,67 @@
"description": "Turn on extending of Kraken2 database to include Bracken files. Requires nucleotide FASTA File input.",
"help_text": "Bracken2 databases are simply just a Kraken2 database with two additional files.\n\nNote however this requires a Kraken2 database _with_ intermediate files still in it, thus can result in large database directories."
},
"bracken_build_params": {
"type": "string",
"description": "Specify parameters being given to bracken build. Must be wrapped in single and double quotes: --bracken_build_params \"'--your_param'\"",
"help_text": "See [Bracken documentation](https://github.com/jenniferlu717/Bracken?tab=readme-ov-file#step-1-generate-the-bracken-database-file-databasexmerskmer_distrib).\n\nParameters must be wrapped in _both_ single and then double quotes outside these, to ensure the parameters are interpreted as a string for internal use rather than interpreted by the terminal as a pipeline-level parameter.",
"fa_icon": "fas fa-users-cog"
},
"build_centrifuge": {
"type": "boolean",
"description": "Turn on building of Centrifuge database. Requires nucleotide FASTA file input.",
"fa_icon": "fas fa-toggle-on"
},
"centrifuge_build_params": {
"type": "string",
"description": "Specify parameters being given to centrifuge-build. Must be wrapped in single and double quotes: --centrifuge_build_params \"'--your_param'\"",
"help_text": "See [Centrifuge documentation](https://github.com/DaehwanKimLab/centrifuge/blob/master/MANUAL.markdown#database-download-and-index-building).\n\nParameters must be wrapped in _both_ single and then double quotes outside these, to ensure the parameters are interpreted as a string for internal use rather than interpreted by the terminal as a pipeline-level parameter.",
"fa_icon": "fas fa-users-cog"
},
"build_diamond": {
"type": "boolean",
"fa_icon": "fas fa-toggle-on",
"description": "Turn on building of DIAMOND database. Requires amino-acid FASTA file input."
},
"diamond_build_params": {
"type": "string",
"description": "Specify parameters being given to diamond makedb. Must be wrapped in single and double quotes: --diamond_build_params \"'--your_param'\"",
"help_text": "See [diamond documentation](https://github.com/bbuchfink/diamond/wiki/3.-Command-line-options#makedb-options).\n\nParameters must be wrapped in _both_ single and then double quotes outside these, to ensure the parameters are interpreted as a string for internal use rather than interpreted by the terminal as a pipeline-level parameter.",
"fa_icon": "fas fa-users-cog"
},
"build_ganon": {
"type": "boolean",
"description": "Turn on building of ganon database. Requires nucleotide FASTA file input.",
"fa_icon": "fas fa-toggle-on"
},
"ganon_build_params": {
"type": "string",
"description": "Specify parameters being given to ganon buildcustom. Must be wrapped in single and double quotes: --ganon_build_params \"'--your_param'\"",
"help_text": "See [ganon documentation](https://pirovc.github.io/ganon/custom_databases/).\n\nParameters must be wrapped in _both_ single and then double quotes outside these, to ensure the parameters are interpreted as a string for internal use rather than interpreted by the terminal as a pipeline-level parameter.",
"fa_icon": "fas fa-users-cog"
},
"build_kaiju": {
"type": "boolean",
"description": "Turn on building of Kaiju database. Requires amino-acid FASTA file input.",
"fa_icon": "fas fa-toggle-on"
},
"kaiju_build_params": {
"type": "string",
"description": "Specify parameters being given to kaiju-mkbwt. Must be wrapped in single and double quotes: --kaiju_build_params \"'--your_param'\"",
"help_text": "See [Kaiju documentation](https://github.com/bioinformatics-centre/kaiju/tree/master#custom-database).\n\nParameters must be wrapped in _both_ single and then double quotes outside these, to ensure the parameters are interpreted as a string for internal use rather than interpreted by the terminal as a pipeline-level parameter.",
"fa_icon": "fas fa-users-cog"
},
"build_kraken2": {
"type": "boolean",
"description": "Turn on building of Kraken2 database. Requires nucleotide FASTA file input.",
"fa_icon": "fas fa-toggle-on"
},
"kraken2_build_params": {
"type": "string",
"description": "Specify parameters being given to kraken2 build. Must be wrapped in single and double quotes: --kraken2_build_params \"'--your_param'\"",
"help_text": "See [Kraken2 documentation](https://github.com/DerrickWood/kraken2/blob/master/docs/MANUAL.markdown#custom-databases).\n\nParameters must be wrapped in _both_ single and then double quotes outside these, to ensure the parameters are interpreted as a string for internal use rather than interpreted by the terminal as a pipeline-level parameter.",
"fa_icon": "fas fa-users-cog"
},
"kraken2_keepintermediate": {
"type": "boolean",
"fa_icon": "fas fa-save",
Expand All @@ -148,18 +184,23 @@
"fa_icon": "fas fa-toggle-on",
"description": "Turn on building of KrakenUniq database. Requires nucleotide FASTA file input."
},
"krakenuniq_build_params": {
"type": "string",
"description": "Specify parameters being given to krakenuniq build. Must be wrapped in single and double quotes: --krakenuniq_build_params \"'--your_param'\"",
"help_text": "See [KrakenUniq documentation](https://github.com/fbreitwieser/krakenuniq?tab=readme-ov-file#database-building).\n\nParameters must be wrapped in _both_ single and then double quotes outside these, to ensure the parameters are interpreted as a string for internal use rather than interpreted by the terminal as a pipeline-level parameter.",
"fa_icon": "fas fa-users-cog"
},
"build_malt": {
"type": "boolean",
"fa_icon": "fas fa-toggle-on",
"description": "Turn on building of MALT database. Requires nucleotide FASTA file input."
},
"malt_sequencetype": {
"malt_build_params": {
"type": "string",
"default": "DNA",
"description": "Specify type of input sequence being given to MALT",
"enum": ["DNA", "Protein"],
"help_text": "Use to specify whether the reference sequences are DNA or Protein sequences. (For RNA sequences, use the DNA setting) - from [MALT manual](https://software-ab.cs.uni-tuebingen.de/download/malt/).\n\n> Modifies tool(s) parameter(s)\n> - malt-build: `--sequenceType` ",
"fa_icon": "fas fa-dna"
"description": "Specify parameters given to malt-build. Must include --sequenceType DNA or Protein and be wrapped in double and single quotes: --malt_build_params \"'--sequenceType DNA --your_param'\"",
"help_text": "At least the type of reference sequences should be specified. (For RNA sequences, use the DNA setting) - from [MALT manual](https://software-ab.cs.uni-tuebingen.de/download/malt/).\n\nParameters must be wrapped in _both_ single and then double quotes outside these, to ensure the parameters are interpreted as a string for internal use rather than interpreted by the terminal as a pipeline-level parameter.",
"default": "--sequenceType DNA",
"fa_icon": "fas fa-users-cog"
}
},
"fa_icon": "fas fa-database"
Expand Down
9 changes: 9 additions & 0 deletions subworkflows/local/utils_nfcore_createtaxdb_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ workflow PIPELINE_INITIALISATION {
//
validateInputParameters()

//
// Custom validation for pipeline parameters
//
validateInputParameters()

//
// Create channel from input file provided through params.input
//
Expand Down Expand Up @@ -168,6 +173,10 @@ def validateInputParameters() {
if (params.build_krakenuniq && [!params.malt_mapdb].any()) {
error('[nf-core/createtaxdb] Supplied --build_malt, but missing: --malt_mapdb (all are mandatory for MALT)')
}

if (params.build_malt && !(params.malt_build_params.contains('--sequenceType DNA') || params.malt_build_params.contains('--sequenceType Protein'))) {
error('[nf-core/createtaxdb] Supplied --build_malt, but --malt_build_params must contain at a minimum malt-build parameters --sequenceType DNA or --sequenceType Protein')
}
}

//
Expand Down
Loading

0 comments on commit 5b5fcda

Please sign in to comment.