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

Include DRAGEN metrics in MULTIQC report #2

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .nf-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repository_type: pipeline
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ Initial release of nf-core/dragen, created with the [nf-core](https://nf-co.re/)

### `Added`

- Publish csv outputs from `DRAGEN` for `multiQC` module
- Stub runs for `DRAGEN`, including creation of a file recognised by the `multiQC` module

### `Fixed`

- Fixed error `Access to 'FASTQC.out' is undefined since the workflow 'FASTQC' has not been invoked before accessing the output attribute` when `-skip_fastqc` enabled by adjusting channel generation
- Added `arm` profile for docker runs on Mac OS

### `Dependencies`

Expand Down
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: "seqeralabs-dragen-methods-description"
description: "Suggested text and references to use when describing pipeline usage within the methods section of a publication."
section_name: "seqeralabs/nf-dragen Methods Description"
section_href: "https://github.com/seqeralabs/nf-dragen"
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 seqeralabs/nf-dragen v${workflow.manifest.version}.</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: 3 additions & 3 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if (!params.skip_dragen) {

withName: 'DRAGEN_FASTQ_TO_BAM_DNA' {
publishDir = [
path: { "${params.outdir}/dragen/dna_fastq_to_bam" },
path: { "${params.outdir}/dragen/dna_fastq_to_bam/${meta.id}/" },
mode: 'copy',
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -74,7 +74,7 @@ if (!params.skip_dragen) {
withName: 'DRAGEN_FASTQ_TO_VCF_DNA' {
ext.args = '--enable-variant-caller true'
publishDir = [
path: { "${params.outdir}/dragen/dna_fastq_to_vcf" },
path: { "${params.outdir}/dragen/dna_fastq_to_vcf/${meta.id}/" },
mode: 'copy',
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -83,7 +83,7 @@ if (!params.skip_dragen) {
withName: 'DRAGEN_FASTQ_TO_BAM_RNA' {
ext.args = '--enable-rna true'
publishDir = [
path: { "${params.outdir}/dragen/rna_fastq_to_bam" },
path: { "${params.outdir}/dragen/rna_fastq_to_bam/${meta.id}/" },
mode: 'copy',
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand Down
19 changes: 19 additions & 0 deletions lib/WorkflowDragen.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/dragen.nf in the nf-core/dragen pipeline
//

import groovy.text.SimpleTemplateEngine

class WorkflowDragen {

//
Expand Down Expand Up @@ -43,6 +45,23 @@ class WorkflowDragen {
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
36 changes: 25 additions & 11 deletions modules.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
{
"name": "nf-core/dragen",
"homePage": "https://github.com/nf-core/dragen",
"name": "nf-dragen",
"homePage": "https://github.com/drpatelh/nf-dragen",
"repos": {
"nf-core/modules": {
"custom/dumpsoftwareversions": {
"git_sha": "20d8250d9f39ddb05dfb437603aaf99b5c0b2b41"
"https://github.com/nf-core/modules.git": {
"modules": {
"nf-core": {
"custom/dumpsoftwareversions": {
"branch": "master",
"git_sha": "7101db4432d3268b7fcb5b8f75fa0a022dc5561b",
"installed_by": ["modules"]
},
"fastqc": {
"branch": "master",
"git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c",
"installed_by": ["modules"]
},
"multiqc": {
"branch": "master",
"git_sha": "ee80d14721e76e2e079103b8dcd5d57129e584ba",
"installed_by": ["modules"],
"patch": "modules/nf-core/multiqc/multiqc.diff"
}
}
},
"fastqc": {
"git_sha": "9d0cad583b9a71a6509b754fdf589cbfbed08961"
},
"multiqc": {
"git_sha": "20d8250d9f39ddb05dfb437603aaf99b5c0b2b41"
"subworkflows": {
"nf-core": {}
}
}
}
}
}
30 changes: 30 additions & 0 deletions modules/local/dragen.nf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ process DRAGEN {
tuple val(meta), path("${prefix}.vcf.gz.tbi") , emit: tbi , optional:true
tuple val(meta), path("${prefix}.hard-filtered.vcf.gz") , emit: vcf_filtered, optional:true
tuple val(meta), path("${prefix}.hard-filtered.vcf.gz.tbi"), emit: tbi_filtered, optional:true
tuple val(meta), path("${prefix}.*.csv") , emit: csv , optional:true
path "versions.yml" , emit: versions

script:
Expand Down Expand Up @@ -52,4 +53,33 @@ process DRAGEN {
dragen: \$(echo \$(/opt/edico/bin/dragen --version 2>&1) | sed -e "s/dragen Version //g")
END_VERSIONS
"""

stub:
prefix = task.ext.prefix ?: "${meta.id}"
// Generate stub files
// Include one possible csv file, and faked data to prompt multiqc
"""
touch ${prefix}.bam
touch ${prefix}.vcf.gz
touch ${prefix}.vcf.gz.tbi
touch ${prefix}.hard-filtered.vcf.gz
touch ${prefix}.hard-filtered.vcf.gz.tbi

# Define the header row of the CSV file
echo "RUN TIME,,Time loading reference,00:00.1,0.09" > ${prefix}.time_metrics.csv
echo "RUN TIME,,Time aligning reads,00:00.5,0.53" >> ${prefix}.time_metrics.csv
echo "RUN TIME,,Time sorting,00:00.4,0.38" >> ${prefix}.time_metrics.csv
echo "RUN TIME,,Time DRAGStr calibration,00:00.0,0" >> ${prefix}.time_metrics.csv
echo "RUN TIME,,Time saving map/align output,00:05.6,5.57" >> ${prefix}.time_metrics.csv
echo "RUN TIME,,Time variant calling,00:05.5,5.45" >> ${prefix}.time_metrics.csv
echo "RUN TIME,,Time partitioning,00:00.1,0.12" >> ${prefix}.time_metrics.csv
echo "RUN TIME,,Time structural variant calling,00:02.8,2.83" >> ${prefix}.time_metrics.csv
echo "RUN TIME,,Time accessing license server,00:13.2,13.21" >> ${prefix}.time_metrics.csv
echo "RUN TIME,,Total runtime,00:27.2,27.17" >> ${prefix}.time_metrics.csv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
dragen: \$(echo "vSTUB")
END_VERSIONS
"""
}
11 changes: 11 additions & 0 deletions modules/local/dragen_buildhashtable.nf
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,15 @@ process DRAGEN_BUILDHASHTABLE {
dragen: \$(echo \$(/opt/edico/bin/dragen --version 2>&1) | sed -e "s/dragen Version //g")
END_VERSIONS
"""

stub:
prefix = task.ext.prefix ?: 'dragen'
"""
mkdir -p $prefix
touch $prefix/dragen.ht
cat <<-END_VERSIONS > versions.yml
"${task.process}":
dragen: \$(echo "v3.4.12")
END_VERSIONS
"""
}

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

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

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

51 changes: 51 additions & 0 deletions modules/nf-core/fastqc/main.nf

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

Loading