-
Couldn't load subscription status.
- Fork 218
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
base: dev
Are you sure you want to change the base?
Changes from all commits
6286228
08998dd
e71b40d
da6ff61
7aa626c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -322,6 +322,7 @@ manifest { | |||||
| // Nextflow plugins | ||||||
| plugins { | ||||||
| id '[email protected]' // Validation of pipeline parameters and creation of an input channel from a sample sheet | ||||||
| id '[email protected]' // 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
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. Is this because you want nf-core-utils to be at a stable release? |
||||||
| } | ||||||
|
|
||||||
| validation { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,19 +8,25 @@ | |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| */ | ||
|
|
||
| {% 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' | ||
| include { paramsHelp } 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' | ||
|
|
||
| /* | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
@@ -48,58 +54,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 | ||
| // | ||
| log.info paramsSummaryLog(workflow) | ||
|
|
||
| {%- if is_nfcore %} | ||
| before_text = """ | ||
| -\033[2m----------------------------------------------------\033[0m- | ||
| \033[0;32m,--.\033[0;30m/\033[0;32m,-.\033[0m | ||
| \033[0;34m ___ __ __ __ ___ \033[0;32m/,-._.--~\'\033[0m | ||
| \033[0;34m |\\ | |__ __ / ` / \\ |__) |__ \033[0;33m} {\033[0m | ||
| \033[0;34m | \\| | \\__, \\__/ | \\ |___ \033[0;32m\\`-._,-`-,\033[0m | ||
| \033[0;32m`._,._,\'\033[0m | ||
| \033[0;35m {{ name }} ${workflow.manifest.version}\033[0m | ||
| -\033[2m----------------------------------------------------\033[0m- | ||
| """ | ||
| after_text = """${workflow.manifest.doi ? "\n* The pipeline\n" : ""}${workflow.manifest.doi.tokenize(",").collect { " https://doi.org/${it.trim().replace('https://doi.org/','')}"}.join("\n")}${workflow.manifest.doi ? "\n" : ""} | ||
| * The nf-core framework | ||
| https://doi.org/10.1038/s41587-020-0439-x | ||
|
|
||
| * Software dependencies | ||
| https://github.com/{{ name }}/blob/{{ default_branch }}/CITATIONS.md | ||
| """{% endif %} | ||
| command = "nextflow run ${workflow.manifest.name} -profile <docker/singularity/.../institute> --input samplesheet.csv --outdir <OUTDIR>" | ||
|
|
||
| UTILS_NFSCHEMA_PLUGIN ( | ||
| workflow, | ||
| validate_params, | ||
| null, | ||
| help, | ||
| help_full, | ||
| show_hidden, | ||
| {% if is_nfcore -%}before_text{%- else %}""{%- endif %}, | ||
| {% if is_nfcore -%}after_text{%- else %}""{%- endif %}, | ||
| command | ||
| ) | ||
| if (validate_params) { | ||
| validateParameters() | ||
| } | ||
| {%- endif %} | ||
|
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. I think you need an additional |
||
|
|
||
| // | ||
| // Check config provided to the pipeline | ||
| // | ||
| UTILS_NFCORE_PIPELINE ( | ||
| nextflow_cli_args | ||
| ) | ||
| checkConfigProvided() | ||
| checkProfileProvided(nextflow_cli_args, monochrome_logs) | ||
|
|
||
| {%- if igenomes %} | ||
|
|
||
|
|
@@ -188,7 +172,7 @@ workflow PIPELINE_COMPLETION { | |
| plaintext_email, | ||
| outdir, | ||
| monochrome_logs, | ||
| {% if multiqc %}multiqc_reports.getVal(),{% else %}[]{% endif %} | ||
| {% if multiqc %}multiqc_reports.getVal(){% else %}[]{% endif %} | ||
| ) | ||
| } | ||
| {%- endif %} | ||
|
|
@@ -213,6 +197,57 @@ workflow PIPELINE_COMPLETION { | |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| */ | ||
|
|
||
| // | ||
| // Get channel of software versions used in pipeline in YAML format | ||
| // | ||
| def softwareVersionsToYAML(ch_versions) { | ||
|
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. should this function be also added to the plugin? 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. It is 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. |
||
| 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() | ||
| }) | ||
| } | ||
|
|
||
| {%- if multiqc %} | ||
| // | ||
| // Get workflow summary for MultiQC | ||
| // | ||
| def paramsSummaryMultiqc(summary_params) { | ||
adamrtalbot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 | ||
| } | ||
| {%- endif %} | ||
|
|
||
| {%- if igenomes %} | ||
| // | ||
| // Check and validate pipeline parameters | ||
|
|
||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.