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

🔧 configure MultiQC analysis #68

Merged
merged 3 commits into from
Mar 28, 2024
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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"downsampling",
"fasta",
"fastq",
"flagstat",
"freebayes",
"ibba",
"markduplicate",
Expand Down
29 changes: 29 additions & 0 deletions assets/methods_description_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
id: "nf-resequencing-mem-methods-description"
description: "Suggested text and references to use when describing pipeline usage within the methods section of a publication."
section_name: "cnr-ibba/nf-resequencing-mem Methods Description"
section_href: "https://github.com/cnr-ibba/nf-resequencing-mem"
plot_type: "html"
## TODO nf-core: Update the HTML below to your preferred 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 cnr-ibba/nf-resequencing-mem 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>), utilising reproducible software environments from the Bioconda (<a href="https://doi.org/10.1038/s41592-018-0046-7">Grüning <em>et al.</em>, 2018</a>) and Biocontainers (<a href="https://doi.org/10.1093/bioinformatics/btx192">da Veiga Leprevost <em>et al.</em>, 2017</a>) projects.</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>
<p>${tool_citations}</p>
<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. doi: <a href="https://doi.org/10.1038/nbt.3820">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. doi: <a href="https://doi.org/10.1038/s41587-020-0439-x">10.1038/s41587-020-0439-x</a></li>
<li>Grüning, B., Dale, R., Sjödin, A., Chapman, B. A., Rowe, J., Tomkins-Tinch, C. H., Valieris, R., Köster, J., & Bioconda Team. (2018). Bioconda: sustainable and comprehensive software distribution for the life sciences. Nature Methods, 15(7), 475–476. doi: <a href="https://doi.org/10.1038/s41592-018-0046-7">10.1038/s41592-018-0046-7</a></li>
<li>da Veiga Leprevost, F., Grüning, B. A., Alves Aflitos, S., Röst, H. L., Uszkoreit, J., Barsnes, H., Vaudel, M., Moreno, P., Gatto, L., Weber, J., Bai, M., Jimenez, R. C., Sachsenberg, T., Pfeuffer, J., Vera Alvarez, R., Griss, J., Nesvizhskii, A. I., & Perez-Riverol, Y. (2017). BioContainers: an open-source and community-driven framework for software standardization. Bioinformatics (Oxford, England), 33(16), 2580–2582. doi: <a href="https://doi.org/10.1093/bioinformatics/btx192">10.1093/bioinformatics/btx192</a></li>
${tool_bibliography}
</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>
22 changes: 20 additions & 2 deletions assets/multiqc_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,31 @@ report_comment: >
analysis pipeline. For information about how to interpret these results, please see the
<a href="https://github.com/cnr-ibba/nf-resequencing-mem/blob/v0.5.2/README.md" target="_blank">documentation</a>.
report_section_order:
software_versions:
"nf-resequencing-mem-methods-description":
order: -1000
cnr-ibba/nf-resequencing-mem-summary:
software_versions:
order: -1001
cnr-ibba-nf-resequencing-mem-summary:
order: -1002

export_plots: true

custom_logo: "cnr-ibba.png"
custom_logo_url: "https://ibba.cnr.it/en/"
custom_logo_title: "CNR-IBBA"

extra_fn_clean_exts:
- ".cram"
- type: remove
pattern: _T1

top_modules:
- fastqc

module_order:
- fastqc
- cutadapt
- samtools
- picard
- bcftools
- snpeff
8 changes: 8 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ process {
]
}

withName: SAMTOOLS_DEPTH {
publishDir = [
path: { "${params.outdir}/coverage" },
mode: params.publish_dir_mode,
pattern: "*.gz"
]
}

withName: FREEBAYES_SPLITCRAM {
publishDir = [
enabled: false
Expand Down
2 changes: 1 addition & 1 deletion modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
"multiqc": {
"branch": "master",
"git_sha": "4ab13872435962dadc239979554d13709e20bf29",
"git_sha": "b7ebe95761cd389603f9cc0e0dc384c0f663815a",
"installed_by": ["modules"]
},
"picard/markduplicates": {
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/multiqc/environment.yml

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

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

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

1 change: 0 additions & 1 deletion modules/nf-core/multiqc/meta.yml

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

53 changes: 37 additions & 16 deletions modules/nf-core/multiqc/tests/main.nf.test

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

41 changes: 41 additions & 0 deletions modules/nf-core/multiqc/tests/main.nf.test.snap

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

2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ params {
genome_bwa_index = null

// MultiQC options
multiqc_config = "$baseDir/assets/multiqc_config.yml"
multiqc_config = null
multiqc_logo = "$baseDir/assets/cnr-ibba.png"
multiqc_title = null
max_multiqc_email_size = '25.MB'
Expand Down
58 changes: 36 additions & 22 deletions workflows/resequencing-mem.nf
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ workflow RESEQUENCING_MEM {
)
.reads
.map {
meta, fastq ->
def meta_clone = meta.clone()
tmp = meta_clone.id.split('_')
if (tmp.size() > 1) {
meta_clone.id = tmp[0..-2].join('_')
}
[ meta_clone, fastq ]
meta, fastq ->
def meta_clone = meta.clone()
tmp = meta_clone.id.split('_')
if (tmp.size() > 1) {
meta_clone.id = tmp[0..-2].join('_')
}
[ meta_clone, fastq ]
}
.groupTuple(by: [0])
.branch {
Expand Down Expand Up @@ -213,25 +213,39 @@ workflow RESEQUENCING_MEM {
}

// get only the data I need for a MultiQC step
multiqc_input = FASTQC.out.html.map{it[1]}.ifEmpty([])
.concat(FASTQC.out.zip.map{it[1]}.ifEmpty([]))
.concat(TRIMGALORE.out.log.map{it[1]}.ifEmpty([]))
.concat(CRAM_MARKDUPLICATES_PICARD.out.metrics.map{it[1]}.ifEmpty([]))
.concat(CRAM_MARKDUPLICATES_PICARD.out.stats.map{it[1]}.ifEmpty([]))
.concat(CRAM_MARKDUPLICATES_PICARD.out.idxstats.map{it[1]}.ifEmpty([]))
.concat(CRAM_MARKDUPLICATES_PICARD.out.flagstat.map{it[1]}.ifEmpty([]))
.concat(CRAM_MARKDUPLICATES_PICARD.out.stats.map{it[1]}.ifEmpty([]))
.concat(snpeff_report.map{it[1]}.ifEmpty([]))
.collect()
// .view()
ch_multiqc_files = FASTQC.out.html.map{it[1]}.ifEmpty([])
.concat(FASTQC.out.zip.map{it[1]}.ifEmpty([]))
.concat(TRIMGALORE.out.log.map{it[1]}.ifEmpty([]))
.concat(CRAM_MARKDUPLICATES_PICARD.out.metrics.map{it[1]}.ifEmpty([]))
.concat(CRAM_MARKDUPLICATES_PICARD.out.stats.map{it[1]}.ifEmpty([]))
.concat(CRAM_MARKDUPLICATES_PICARD.out.idxstats.map{it[1]}.ifEmpty([]))
.concat(CRAM_MARKDUPLICATES_PICARD.out.flagstat.map{it[1]}.ifEmpty([]))
.concat(CRAM_MARKDUPLICATES_PICARD.out.coverage.map{it[1]}.ifEmpty([]))
.concat(BCFTOOLS_STATS.out.stats.map{it[1]}.ifEmpty([]))
.concat(snpeff_report.map{it[1]}.ifEmpty([]))
// .view()

// prepare multiqc_config file
multiqc_config = Channel.fromPath(params.multiqc_config)
multiqc_logo = Channel.fromPath(params.multiqc_logo)
ch_multiqc_config = Channel.fromPath("$projectDir/assets/multiqc_config.yml", checkIfExists: true)
ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath(params.multiqc_config, checkIfExists: true) : Channel.empty()
ch_multiqc_logo = params.multiqc_logo ? Channel.fromPath(params.multiqc_logo, checkIfExists: true) : Channel.empty()

// TODO: requires nf-validation plugin and other stuff
// summary_params = paramsSummaryMap(workflow, parameters_schema: "nextflow_schema.json")
// ch_workflow_summary = Channel.value(paramsSummaryMultiqc(summary_params))
// ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description, checkIfExists: true) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true)
// ch_methods_description = Channel.value(methodsDescriptionText(ch_multiqc_custom_methods_description))
// ch_multiqc_files = ch_multiqc_files.mix(ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml'))
// ch_multiqc_files = ch_multiqc_files.mix(ch_collated_versions)
// ch_multiqc_files = ch_multiqc_files.mix(ch_methods_description.collectFile(name: 'methods_description_mqc.yaml', sort: false))

// calling MultiQC
MULTIQC(multiqc_input, multiqc_config, [], multiqc_logo)
ch_versions = ch_versions.mix(MULTIQC.out.versions)
MULTIQC (
ch_multiqc_files.collect(),
ch_multiqc_config.toList(),
ch_multiqc_custom_config.toList(),
ch_multiqc_logo.toList()
)

// return software version
CUSTOM_DUMPSOFTWAREVERSIONS (
Expand Down
Loading