-
Notifications
You must be signed in to change notification settings - Fork 214
Migrate template to nf-core-utils plugin #3790
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
Open
edmundmiller
wants to merge
1
commit into
dev
Choose a base branch
from
tools-3685
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -317,6 +317,7 @@ manifest { | |||||
// Nextflow plugins | ||||||
plugins { | ||||||
id 'nf-schema@2.4.2' // Validation of pipeline parameters and creation of an input channel from a sample sheet | ||||||
id 'nf-core-utils@0.3.0' // Utility functions for nf-core pipelines | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
|
||||||
validation { | ||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,18 +8,24 @@ | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
*/ | ||
|
||
{% if nf_schema %}include { UTILS_NFSCHEMA_PLUGIN } from '../../nf-core/utils_nfschema_plugin' | ||
{% if nf_schema %}include { paramsSummaryLog } from 'plugin/nf-schema' | ||
include { validateParameters } from 'plugin/nf-schema' | ||
include { paramsSummaryMap } from 'plugin/nf-schema' | ||
include { samplesheetToList } from 'plugin/nf-schema'{% endif %} | ||
{%- if email %} | ||
include { completionEmail } from '../../nf-core/utils_nfcore_pipeline' | ||
include { completionEmail } from 'plugin/nf-core-utils' | ||
{%- endif %} | ||
include { completionSummary } from '../../nf-core/utils_nfcore_pipeline' | ||
include { completionSummary } from 'plugin/nf-core-utils' | ||
{%- if adaptivecard or slackreport %} | ||
include { imNotification } from '../../nf-core/utils_nfcore_pipeline' | ||
include { imNotification } from 'plugin/nf-core-utils' | ||
{%- endif %} | ||
include { UTILS_NFCORE_PIPELINE } from '../../nf-core/utils_nfcore_pipeline' | ||
include { UTILS_NEXTFLOW_PIPELINE } from '../../nf-core/utils_nextflow_pipeline' | ||
include { checkConfigProvided } from 'plugin/nf-core-utils' | ||
include { checkProfileProvided } from 'plugin/nf-core-utils' | ||
include { getWorkflowVersion } from 'plugin/nf-core-utils' | ||
include { dumpParametersToJSON } from 'plugin/nf-core-utils' | ||
include { checkCondaChannels } from 'plugin/nf-core-utils' | ||
include { processVersionsFromFile } from 'plugin/nf-core-utils' | ||
include { workflowVersionToChannel } from 'plugin/nf-core-utils' | ||
|
||
/* | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
@@ -44,31 +50,36 @@ workflow PIPELINE_INITIALISATION { | |
// | ||
// Print version and exit if required and dump pipeline parameters to JSON file | ||
// | ||
UTILS_NEXTFLOW_PIPELINE ( | ||
version, | ||
true, | ||
outdir, | ||
workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1 | ||
) | ||
if (version) { | ||
log.info("${workflow.manifest.name} ${getWorkflowVersion(workflow.manifest.version, workflow.commitId)}") | ||
System.exit(0) | ||
} | ||
|
||
if (outdir) { | ||
dumpParametersToJSON(outdir, params) | ||
} | ||
|
||
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { | ||
checkCondaChannels() | ||
} | ||
|
||
{%- if nf_schema %} | ||
|
||
// | ||
// Validate parameters and generate parameter summary to stdout | ||
// | ||
UTILS_NFSCHEMA_PLUGIN ( | ||
workflow, | ||
validate_params, | ||
null | ||
) | ||
log.info paramsSummaryLog(workflow) | ||
|
||
if (validate_params) { | ||
validateParameters() | ||
} | ||
{%- endif %} | ||
|
||
// | ||
// Check config provided to the pipeline | ||
// | ||
UTILS_NFCORE_PIPELINE ( | ||
nextflow_cli_args | ||
) | ||
checkConfigProvided() | ||
checkProfileProvided(nextflow_cli_args, monochrome_logs) | ||
|
||
{%- if igenomes %} | ||
|
||
|
@@ -157,7 +168,7 @@ workflow PIPELINE_COMPLETION { | |
plaintext_email, | ||
outdir, | ||
monochrome_logs, | ||
{% if multiqc %}multiqc_reports.getVal(),{% else %}[]{% endif %} | ||
{% if multiqc %}multiqc_reports.getVal(){% else %}[]{% endif %} | ||
) | ||
} | ||
{%- endif %} | ||
|
@@ -182,6 +193,55 @@ workflow PIPELINE_COMPLETION { | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
*/ | ||
|
||
// | ||
// Get channel of software versions used in pipeline in YAML format | ||
// | ||
def softwareVersionsToYAML(ch_versions) { | ||
return ch_versions.unique() | ||
.map { version -> processVersionsFromFile([version.toString()]) } | ||
.unique() | ||
.mix(Channel.fromList(workflowVersionToChannel(workflow.session)).map { it -> | ||
""" | ||
Workflow: | ||
${it[1]}: ${it[2]} | ||
""".stripIndent().trim() | ||
}) | ||
} | ||
|
||
// | ||
// Get workflow summary for MultiQC | ||
// | ||
def paramsSummaryMultiqc(summary_params) { | ||
Comment on lines
+211
to
+214
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrap this whole function inside a |
||
def summary_section = '' | ||
summary_params | ||
.keySet() | ||
.each { group -> | ||
def group_params = summary_params.get(group) | ||
// This gets the parameters of that particular group | ||
if (group_params) { | ||
summary_section += " <p style=\"font-size:110%\"><b>${group}</b></p>\n" | ||
summary_section += " <dl class=\"dl-horizontal\">\n" | ||
group_params | ||
.keySet() | ||
.sort() | ||
.each { param -> | ||
summary_section += " <dt>${param}</dt><dd><samp>${group_params.get(param) ?: '<span style=\"color:#999999;\">N/A</a>'}</samp></dd>\n" | ||
} | ||
summary_section += " </dl>\n" | ||
} | ||
} | ||
|
||
def yaml_file_text = "id: '${workflow.manifest.name.replace('/', '-')}-summary'\n" as String | ||
yaml_file_text += "description: ' - this information is collected when the pipeline is started.'\n" | ||
yaml_file_text += "section_name: '${workflow.manifest.name} Workflow Summary'\n" | ||
yaml_file_text += "section_href: 'https://github.com/${workflow.manifest.name}'\n" | ||
yaml_file_text += "plot_type: 'html'\n" | ||
yaml_file_text += "data: |\n" | ||
yaml_file_text += "${summary_section}" | ||
|
||
return yaml_file_text | ||
} | ||
|
||
{%- if igenomes %} | ||
// | ||
// Check and validate pipeline parameters | ||
|
126 changes: 0 additions & 126 deletions
126
nf_core/pipeline-template/subworkflows/nf-core/utils_nextflow_pipeline/main.nf
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
nf_core/pipeline-template/subworkflows/nf-core/utils_nextflow_pipeline/meta.yml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs a
{% if email %}
wrapper