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

nf core template merge 2.6 #773

Merged
merged 9 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .github/workflows/awsfulltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ jobs:
"outdir": "s3://${{ secrets.AWS_S3_BUCKET }}/sarek/results-${{ github.sha }}/germline_test"
}
profiles: test_full,aws_tower
- uses: actions/upload-artifact@v3
with:
name: Tower debug log file
path: tower_action_*.log
4 changes: 4 additions & 0 deletions .github/workflows/awstest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ jobs:
"outdir": "s3://${{ secrets.AWS_S3_BUCKET }}/sarek/results-test-${{ github.sha }}"
}
profiles: test,aws_tower
- uses: actions/upload-artifact@v3
with:
name: Tower debug log file
path: tower_action_*.log
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
email_template.html
adaptivecard.json
.nextflow*
work/
data/
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [#762](https://github.com/nf-core/sarek/pull/762) - Back to dev
- [#762](https://github.com/nf-core/sarek/pull/762) - Update deepvariant module
- [#773](https://github.com/nf-core/sarek/pull/773) - Sync `TEMPLATE` with `tools` `2.6`

### Fixed

Expand Down
67 changes: 67 additions & 0 deletions assets/adaptivecard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": null,
"content": {
"\$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"msteams": {
"width": "Full"
},
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"color": "<% if (success) { %>Good<% } else { %>Attention<%} %>",
"text": "nf-core/sarek v${version} - ${runName}",
"wrap": true
},
{
"type": "TextBlock",
"spacing": "None",
"text": "Completed at ${dateComplete} (duration: ${duration})",
"isSubtle": true,
"wrap": true
},
{
"type": "TextBlock",
"text": "<% if (success) { %>Pipeline completed successfully!<% } else { %>Pipeline completed with errors. The full error message was: ${errorReport}.<% } %>",
"wrap": true
},
{
"type": "TextBlock",
"text": "The command used to launch the workflow was as follows:",
"wrap": true
},
{
"type": "TextBlock",
"text": "${commandLine}",
"isSubtle": true,
"wrap": true
}
],
"actions": [
{
"type": "Action.ShowCard",
"title": "Pipeline Configuration",
"card": {
"type": "AdaptiveCard",
"\$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"body": [
{
"type": "FactSet",
"facts": [<% out << summary.collect{ k,v -> "{\"title\": \"$k\", \"value\" : \"$v\"}"}.join(",\n") %>
]
}
]
}
}
]
}
}
]
}
25 changes: 25 additions & 0 deletions assets/methods_description_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
id: "nf-core-sarek-methods-description"
description: "Suggested text and references to use when describing pipeline usage within the methods section of a publication."
section_name: "nf-core/sarek Methods Description"
section_href: "https://github.com/nf-core/sarek"
plot_type: "html"
## TODO nf-core: Update the HTML below to your prefered methods description, e.g. add publication citation for this pipeline
## You inject any metadata in the Nextflow '${workflow}' object
data: |
<h4>Methods</h4>
<p>Data was processed using nf-core/sarek v${workflow.manifest.version} ${doi_text} of the nf-core collection of workflows (<a href="https://doi.org/10.1038/s41587-020-0439-x">Ewels <em>et al.</em>, 2020</a>).</p>
<p>The pipeline was executed with Nextflow v${workflow.nextflow.version} (<a href="https://doi.org/10.1038/nbt.3820">Di Tommaso <em>et al.</em>, 2017</a>) with the following command:</p>
<pre><code>${workflow.commandLine}</code></pre>
<h4>References</h4>
<ul>
<li>Di Tommaso, P., Chatzou, M., Floden, E. W., Barja, P. P., Palumbo, E., & Notredame, C. (2017). Nextflow enables reproducible computational workflows. Nature Biotechnology, 35(4), 316-319. <a href="https://doi.org/10.1038/nbt.3820">https://doi.org/10.1038/nbt.3820</a></li>
<li>Ewels, P. A., Peltzer, A., Fillinger, S., Patel, H., Alneberg, J., Wilm, A., Garcia, M. U., Di Tommaso, P., & Nahnsen, S. (2020). The nf-core framework for community-curated bioinformatics pipelines. Nature Biotechnology, 38(3), 276-278. <a href="https://doi.org/10.1038/s41587-020-0439-x">https://doi.org/10.1038/s41587-020-0439-x</a></li>
</ul>
<div class="alert alert-info">
<h5>Notes:</h5>
<ul>
${nodoi_text}
<li>The command above does not include parameters contained in any configs or profiles that may have been used. Ensure the config file is also uploaded with your publication!</li>
<li>You should also cite all software used within this run. Check the "Software Versions" of this report to get version information.</li>
</ul>
</div>
6 changes: 4 additions & 2 deletions assets/multiqc_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ report_comment: >
analysis pipeline. For information about how to interpret these results, please see the
<a href="https://nf-co.re/sarek" target="_blank">documentation</a>.
report_section_order:
software_versions:
"nf-core-sarek-methods-description":
order: -1000
nf-core-sarek-summary:
software_versions:
order: -1001
"nf-core-sarek-summary":
order: -1002

export_plots: true

Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ If you have any questions or issues please send us a message on [Slack](https://
## Azure Resource Requests

To be used with the `azurebatch` profile by specifying the `-profile azurebatch`.
We recomend providing a compute `params.vm_type` of `Standard_E64_v3` VMs by default but these options can be changed if required.
We recommend providing a compute `params.vm_type` of `Standard_D16_v3` VMs by default but these options can be changed if required.

Note that the choice of VM size depends on your quota and the overall workload during the analysis.
For a thorough list, please refer the [Azure Sizes for virtual machines in Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/sizes).
Expand Down
55 changes: 55 additions & 0 deletions lib/NfcoreTemplate.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,61 @@ class NfcoreTemplate {
output_tf.withWriter { w -> w << email_txt }
}

//
// Construct and send adaptive card
// https://adaptivecards.io
//
public static void adaptivecard(workflow, params, summary_params, projectDir, log) {
def hook_url = params.hook_url

def summary = [:]
for (group in summary_params.keySet()) {
summary << summary_params[group]
}

def misc_fields = [:]
misc_fields['start'] = workflow.start
misc_fields['complete'] = workflow.complete
misc_fields['scriptfile'] = workflow.scriptFile
misc_fields['scriptid'] = workflow.scriptId
if (workflow.repository) misc_fields['repository'] = workflow.repository
if (workflow.commitId) misc_fields['commitid'] = workflow.commitId
if (workflow.revision) misc_fields['revision'] = workflow.revision
misc_fields['nxf_version'] = workflow.nextflow.version
misc_fields['nxf_build'] = workflow.nextflow.build
misc_fields['nxf_timestamp'] = workflow.nextflow.timestamp

def msg_fields = [:]
msg_fields['version'] = workflow.manifest.version
msg_fields['runName'] = workflow.runName
msg_fields['success'] = workflow.success
msg_fields['dateComplete'] = workflow.complete
msg_fields['duration'] = workflow.duration
msg_fields['exitStatus'] = workflow.exitStatus
msg_fields['errorMessage'] = (workflow.errorMessage ?: 'None')
msg_fields['errorReport'] = (workflow.errorReport ?: 'None')
msg_fields['commandLine'] = workflow.commandLine
msg_fields['projectDir'] = workflow.projectDir
msg_fields['summary'] = summary << misc_fields

// Render the JSON template
def engine = new groovy.text.GStringTemplateEngine()
def hf = new File("$projectDir/assets/adaptivecard.json")
def json_template = engine.createTemplate(hf).make(msg_fields)
def json_message = json_template.toString()

// POST
def post = new URL(hook_url).openConnection();
post.setRequestMethod("POST")
post.setDoOutput(true)
post.setRequestProperty("Content-Type", "application/json")
post.getOutputStream().write(json_message.getBytes("UTF-8"));
def postRC = post.getResponseCode();
if (! postRC.equals(200)) {
log.warn(post.getErrorStream().getText());
}
}

//
// Print pipeline summary on completion
//
Expand Down
21 changes: 14 additions & 7 deletions lib/Utils.groovy
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,26 @@ class Utils {
}

// Check that all channels are present
def required_channels = ['conda-forge', 'bioconda', 'defaults']
def conda_check_failed = !required_channels.every { ch -> ch in channels }
// This channel list is ordered by required channel priority.
def required_channels_in_order = ['conda-forge', 'bioconda', 'defaults']
def channels_missing = ((required_channels_in_order as Set) - (channels as Set)) as Boolean

// Check that they are in the right order
conda_check_failed |= !(channels.indexOf('conda-forge') < channels.indexOf('bioconda'))
conda_check_failed |= !(channels.indexOf('bioconda') < channels.indexOf('defaults'))
def channel_priority_violation = false
def n = required_channels_in_order.size()
for (int i = 0; i < n - 1; i++) {
channel_priority_violation |= !(channels.indexOf(required_channels_in_order[i]) < channels.indexOf(required_channels_in_order[i+1]))
}

if (conda_check_failed) {
if (channels_missing | channel_priority_violation) {
log.warn "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
" There is a problem with your Conda configuration!\n\n" +
" You will need to set-up the conda-forge and bioconda channels correctly.\n" +
" Please refer to https://bioconda.github.io/user/install.html#set-up-channels\n" +
" NB: The order of the channels matters!\n" +
" Please refer to https://bioconda.github.io/\n" +
" The observed channel order is \n" +
" ${channels}\n" +
" but the following channel order is required:\n" +
" ${required_channels_in_order}\n" +
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
}
}
Expand Down
19 changes: 19 additions & 0 deletions lib/WorkflowSarek.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// This file holds several functions specific to the workflow/sarek.nf in the nf-core/sarek pipeline
//

import groovy.text.SimpleTemplateEngine

class WorkflowSarek {

//
Expand Down Expand Up @@ -42,6 +44,23 @@ class WorkflowSarek {
yaml_file_text += "data: |\n"
yaml_file_text += "${summary_section}"
return yaml_file_text
}

public static String methodsDescriptionText(run_workflow, mqc_methods_yaml) {
// Convert to a named map so can be used as with familar NXF ${workflow} variable syntax in the MultiQC YML file
def meta = [:]
meta.workflow = run_workflow.toMap()
meta["manifest_map"] = run_workflow.manifest.toMap()

meta["doi_text"] = meta.manifest_map.doi ? "(doi: <a href=\'https://doi.org/${meta.manifest_map.doi}\'>${meta.manifest_map.doi}</a>)" : ""
meta["nodoi_text"] = meta.manifest_map.doi ? "": "<li>If available, make sure to update the text to include the Zenodo DOI of version of the pipeline used. </li>"

def methods_text = mqc_methods_yaml.text

def engine = new SimpleTemplateEngine()
def description_html = engine.createTemplate(methods_text).make(meta)

return description_html
}//
// Exit pipeline if incorrect --genome key provided
//
Expand Down
3 changes: 1 addition & 2 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@
},
"gatk4/cnnscorevariants": {
maxulysse marked this conversation as resolved.
Show resolved Hide resolved
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"patch": "modules/nf-core/gatk4/cnnscorevariants/gatk4-cnnscorevariants.diff"
"git_sha": "1832dc139342122c9617bfcd5c38c8fb8dd060ad"
},
"gatk4/createsequencedictionary": {
"branch": "master",
Expand Down

This file was deleted.

16 changes: 10 additions & 6 deletions modules/nf-core/multiqc/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ params {
vep_include_fasta = false // Don't use fasta file for annotation with VEP

// MultiQC options
multiqc_config = null
multiqc_title = null
max_multiqc_email_size = '25.MB'
multiqc_config = null
multiqc_title = null
multiqc_logo = null
max_multiqc_email_size = '25.MB'
multiqc_methods_description = null

// Boilerplate options
outdir = 'results'
Expand All @@ -98,6 +100,7 @@ params {
email_on_fail = null
plaintext_email = false
monochrome_logs = false
hook_url = null
help = false
validate_params = true
show_hidden_params = false
Expand Down Expand Up @@ -278,6 +281,7 @@ manifest {
mainScript = 'main.nf'
nextflowVersion = '!>=21.10.3'
version = '3.1dev'
doi = '10.12688/f1000research.16665.2, 10.5281/zenodo.4063683'
}

// Load modules.config for DSL2 module specific options
Expand Down
Loading