Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add module parameters #51

Merged
merged 33 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b0cf838
add module parameters
alxndrdiaz Oct 15, 2024
ff2c1a2
linting
alxndrdiaz Oct 15, 2024
55ff9fd
linting
alxndrdiaz Oct 15, 2024
66133af
empty string instead of null
alxndrdiaz Oct 16, 2024
bcc8571
malt params update
alxndrdiaz Nov 16, 2024
c808195
fix malt warning
alxndrdiaz Dec 12, 2024
671329f
Start adding gagnon
jfy133 Oct 29, 2024
52473c4
Continue work
jfy133 Nov 9, 2024
1bed547
Revert manual change to ganonbuild module (to upstreeam the fix)
jfy133 Nov 9, 2024
08aa4c1
Add working ganon-build (missing docs)
jfy133 Nov 28, 2024
784a38d
Add better input validation tests
jfy133 Nov 28, 2024
30aace6
Add reference to ganon across all test profiles and fix typo
jfy133 Nov 28, 2024
dc28bc9
Update test
jfy133 Nov 28, 2024
086499c
Add current required documentation
jfy133 Nov 28, 2024
6ac547b
Fix mangled regex strings
jfy133 Nov 28, 2024
99ca0f2
update malt/build module
LilyAnderssonLee Nov 28, 2024
1955707
add module parameters
alxndrdiaz Oct 15, 2024
2d944fd
empty string instead of null
alxndrdiaz Oct 16, 2024
82b2a2b
Merge branch 'dev' into module_parameters
alxndrdiaz Dec 12, 2024
7ac5212
linting
alxndrdiaz Dec 12, 2024
9d09377
Move MALT check to pipeline initilaisation
jfy133 Dec 19, 2024
590e51e
Add missing flags
jfy133 Dec 19, 2024
52cac91
Add caveat about double/single quotes for build params
jfy133 Dec 19, 2024
79739e0
Remove debuggin code
jfy133 Dec 19, 2024
e3b8e9b
Add more documentation
jfy133 Dec 19, 2024
f91664f
Try and get Krakenuniq towork
jfy133 Dec 19, 2024
4026178
Merge branch 'dev' of https://github.com/nf-core/createtaxdb into mod…
jfy133 Dec 19, 2024
58a0f70
Apply suggestions from code review
jfy133 Dec 19, 2024
1559578
Remove affiliation Alexander
jfy133 Dec 20, 2024
479f5d5
Specify path to jellyfish bin
jfy133 Dec 20, 2024
167a25d
Escape bash variable
jfy133 Dec 20, 2024
4d4a905
Get jellyfish working with the bin
jfy133 Dec 20, 2024
8c7c803
Move test profile params for KU to new build params
jfy133 Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +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}\"" : '' }
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 @@ -33,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 @@ -43,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} --jellyfish-bin type -P -a jellyfish)" }
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
}

withName: MALT_BUILD {
ext.args = { "--sequenceType ${params.malt_sequencetype}" }
ext.args = { "${params.malt_build_params}" }
}
}
13 changes: 10 additions & 3 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,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
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
19 changes: 14 additions & 5 deletions subworkflows/local/utils_nfcore_createtaxdb_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ workflow PIPELINE_INITIALISATION {
version,
true,
outdir,
workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1
workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1,
)

//
Expand All @@ -52,7 +52,7 @@ workflow PIPELINE_INITIALISATION {
UTILS_NFSCHEMA_PLUGIN(
workflow,
validate_params,
null
null,
)

//
Expand All @@ -62,6 +62,11 @@ workflow PIPELINE_INITIALISATION {
nextflow_cli_args
)

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

//
// Create channel from input file provided through params.input
//
Expand Down Expand Up @@ -104,7 +109,7 @@ workflow PIPELINE_COMPLETION {
plaintext_email,
outdir,
monochrome_logs,
multiqc_report.toList()
multiqc_report.toList(),
)
}

Expand Down Expand Up @@ -159,6 +164,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 Expand Up @@ -193,7 +202,7 @@ def toolCitationText() {
params.build_krakenuniq ? "KrakenUniq (Breitwieser et al. 2018)," : "",
params.build_malt ? "MALT (Vågene et al. 2018)," : "",
"and MultiQC (Ewels et al. 2016)",
"."
".",
].join(' ').trim()

return citation_text
Expand All @@ -212,7 +221,7 @@ def toolBibliographyText() {
params.build_kraken2 ? '<li>Wood, D. E., Lu, J., & Langmead, B. (2019). Improved metagenomic analysis with Kraken 2. Genome Biology, 20(1), 257. <a href="https://doi.org/10.1186/s13059-019-1891-0">10.1186/s13059-019-1891-0</a></li>' : "",
params.build_krakenuniq ? '<li>Breitwieser, F. P., Baker, D. N., & Salzberg, S. L. (2018). KrakenUniq: confident and fast metagenomics classification using unique k-mer counts. Genome Biology, 19(1), 198. <a href="https://doi.org/10.1186/s13059-018-1568-0">10.1186/s13059-018-1568-0</a></li>' : "",
params.build_malt ? '<li>Vågene, Å. J., Herbig, A., Campana, M. G., Robles García, N. M., Warinner, C., Sabin, S., Spyrou, M. A., Andrades Valtueña, A., Huson, D., Tuross, N., Bos, K. I., & Krause, J. (2018). Salmonella enterica genomes from victims of a major sixteenth-century epidemic in Mexico. Nature Ecology & Evolution, 2(3), 520–528. <a href="https://doi.org/10.1038/s41559-017-0446-6">10.1038/s41559-017-0446-6</a></li>' : "",
'<li>Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: /10.1093/bioinformatics/btw354</li>'
'<li>Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: /10.1093/bioinformatics/btw354</li>',
].join(' ').trim()

return reference_text
Expand Down
Loading
Loading