Skip to content

Commit

Permalink
Merge pull request #3129 from mirpedrol/template-customisation-fastqc
Browse files Browse the repository at this point in the history
Template: add option to exclude fastqc from pipeline template
  • Loading branch information
mirpedrol authored Aug 26, 2024
2 parents 65751e9 + 9d29e93 commit 2eb5458
Show file tree
Hide file tree
Showing 21 changed files with 430 additions and 423 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- add option to exclude changelog from custom pipeline template ([#3104](https://github.com/nf-core/tools/pull/3104))
- add option to exclude license from pipeline template ([#3125](https://github.com/nf-core/tools/pull/3125))
- add option to exclude email from pipeline template ([#3126](https://github.com/nf-core/tools/pull/3126))
- add option to exclude fastqc from pipeline template ([#3129](https://github.com/nf-core/tools/pull/3129))

### Linting

Expand Down
6 changes: 2 additions & 4 deletions nf_core/components/lint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ def __init__(
)
)
if not self.all_remote_components:
raise LookupError(
f"No {self.component_type} from {self.modules_repo.remote_url} installed in pipeline."
)
log.warning(f"No {self.component_type} from {self.modules_repo.remote_url} installed in pipeline.")
local_component_dir = Path(self.directory, self.component_type, "local")

if local_component_dir.exists():
Expand Down Expand Up @@ -146,7 +144,7 @@ def __init__(
]
self.all_local_components = []
if not self.all_remote_components:
raise LookupError(f"No {self.component_type} in '{self.component_type}' directory")
log.warning(f"No {self.component_type} in '{self.component_type}' directory")

# This could be better, perhaps glob for all nextflow.config files in?
self.config = nf_core.utils.fetch_wf_config(self.directory / "tests" / "config", cache_config=True)
Expand Down
2 changes: 1 addition & 1 deletion nf_core/modules/lint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def lint(
"""
# TODO: consider unifying modules and subworkflows lint() function and add it to the ComponentLint class
# Prompt for module or all
if module is None and not all_modules:
if module is None and not all_modules and len(self.all_remote_components) > 0:
questions = [
{
"type": "list",
Expand Down
7 changes: 3 additions & 4 deletions nf_core/pipeline-template/CITATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@

## Pipeline tools

- [FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/)
{% if fastqc %}- [FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/)

> Andrews, S. (2010). FastQC: A Quality Control Tool for High Throughput Sequence Data [Online].
{% if multiqc %}- [MultiQC](https://pubmed.ncbi.nlm.nih.gov/27312411/)
> Andrews, S. (2010). FastQC: A Quality Control Tool for High Throughput Sequence Data [Online].
> {% endif %} > {% if multiqc %}- [MultiQC](https://pubmed.ncbi.nlm.nih.gov/27312411/)
> Ewels P, Magnusson M, Lundin S, Käller M. MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics. 2016 Oct 1;32(19):3047-8. doi: 10.1093/bioinformatics/btw354. Epub 2016 Jun 16. PubMed PMID: 27312411; PubMed Central PMCID: PMC5039924.
> {%- endif %}
Expand Down
4 changes: 2 additions & 2 deletions nf_core/pipeline-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
workflows use the "tube map" design for that. See https://nf-co.re/docs/contributing/design_guidelines#examples for examples. -->
<!-- TODO nf-core: Fill in short bullet-pointed list of the default steps in the pipeline -->

1. Read QC ([`FastQC`](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/))
{% if multiqc %}2. Present QC for raw reads ([`MultiQC`](http://multiqc.info/)){% endif %}
{% if fastqc %}1. Read QC ([`FastQC`](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/)){% endif %}
{% if multiqc %}2. Present QC for raw reads ([`MultiQC`](http://multiqc.info/)){% endif %}

## Usage

Expand Down
2 changes: 2 additions & 0 deletions nf_core/pipeline-template/conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ process {
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]

{% if fastqc -%}
withName: FASTQC {
ext.args = '--quiet'
}
{%- endif %}

{%- if multiqc %}
withName: 'MULTIQC' {
Expand Down
9 changes: 6 additions & 3 deletions nf_core/pipeline-template/docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ The directories listed below will be created in the results directory after the

The pipeline is built using [Nextflow](https://www.nextflow.io/) and processes data using the following steps:

- [FastQC](#fastqc) - Raw read QC
{% if multiqc %}- [MultiQC](#multiqc) - Aggregate report describing results and QC from the whole pipeline{% endif %}
{% if fastqc %}- [FastQC](#fastqc) - Raw read QC{% endif %}
{% if multiqc %}- [MultiQC](#multiqc) - Aggregate report describing results and QC from the whole pipeline{% endif %}

- [Pipeline information](#pipeline-information) - Report metrics generated during the workflow execution

{%- if fastqc %}

### FastQC

<details markdown="1">
Expand All @@ -28,7 +31,7 @@ The pipeline is built using [Nextflow](https://www.nextflow.io/) and processes d
</details>

[FastQC](http://www.bioinformatics.babraham.ac.uk/projects/fastqc/) gives general quality metrics about your sequenced reads. It provides information about the quality score distribution across your reads, per base sequence content (%A/T/G/C), adapter contamination and overrepresented sequences. For further reading and documentation see the [FastQC help pages](http://www.bioinformatics.babraham.ac.uk/projects/fastqc/Help/).

{%- endif %}
{%- if multiqc %}

### MultiQC
Expand Down
3 changes: 2 additions & 1 deletion nf_core/pipeline-template/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
"https://github.com/nf-core/modules.git": {
"modules": {
"nf-core": {
{%- if fastqc %}
"fastqc": {
"branch": "master",
"git_sha": "285a50500f9e02578d90b3ce6382ea3c30216acd",
"installed_by": ["modules"]
}{%- if multiqc %},
}{% endif %}{%- if multiqc %}{% if fastqc %},{% endif %}
"multiqc": {
"branch": "master",
"git_sha": "b7ebe95761cd389603f9cc0e0dc384c0f663815a",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ def toolCitationText() {
// Uncomment function in methodsDescriptionText to render in MultiQC report
def citation_text = [
"Tools used in the workflow included:",
"FastQC (Andrews 2010),",
"MultiQC (Ewels et al. 2016)",
{% if fastqc %}"FastQC (Andrews 2010),",{% endif %}
{% if multiqc %}"MultiQC (Ewels et al. 2016)",{% endif %}
"."
].join(' ').trim()

Expand All @@ -243,8 +243,8 @@ def toolBibliographyText() {
// Can use ternary operators to dynamically construct based conditions, e.g. params["run_xyz"] ? "<li>Author (2023) Pub name, Journal, DOI</li>" : "",
// Uncomment function in methodsDescriptionText to render in MultiQC report
def reference_text = [
"<li>Andrews S, (2010) FastQC, URL: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/).</li>",
"<li>Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: /10.1093/bioinformatics/btw354</li>"
{% if fastqc %}"<li>Andrews S, (2010) FastQC, URL: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/).</li>",{% endif %}
{% if multiqc %}"<li>Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: /10.1093/bioinformatics/btw354</li>"{% endif %}
].join(' ').trim()

return reference_text
Expand Down
6 changes: 4 additions & 2 deletions nf_core/pipeline-template/workflows/pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

include { FASTQC } from '../modules/nf-core/fastqc/main'
{% if fastqc %}include { FASTQC } from '../modules/nf-core/fastqc/main'{% endif %}
{% if multiqc %}include { MULTIQC } from '../modules/nf-core/multiqc/main'{% endif %}
include { paramsSummaryMap } from 'plugin/nf-validation'
{% if multiqc %}include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'{% endif %}
Expand All @@ -27,6 +27,7 @@ workflow {{ short_name|upper }} {
ch_versions = Channel.empty()
{% if multiqc %}ch_multiqc_files = Channel.empty(){% endif %}

{%- if fastqc %}
//
// MODULE: Run FastQC
//
Expand All @@ -35,14 +36,15 @@ workflow {{ short_name|upper }} {
)
{% if multiqc %}ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}){% endif %}
ch_versions = ch_versions.mix(FASTQC.out.versions.first())
{%- endif %}

//
// Collate and save software versions
//
softwareVersionsToYAML(ch_versions)
.collectFile(
storeDir: "${params.outdir}/pipeline_info",
name: 'nf_core_pipeline_software_mqc_versions.yml',
name: {% if is_nfcore %}'nf_core_' {% else %} '' {% endif %} + 'pipeline_software_' + {% if multiqc %} 'mqc_' {% else %} '' {% endif %} + 'versions.yml',
sort: true,
newLine: true
).set { ch_collated_versions }
Expand Down
10 changes: 10 additions & 0 deletions nf_core/pipelines/create/templatefeatures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,16 @@ multiqc:
multiqc_config: False
nfcore_pipelines: True
custom_pipelines: True
fastqc:
skippable_paths:
- "modules/nf-core/fastqc/"
short_description: "Use fastqc"
description: "The pipeline will include the FastQC module which performs quality control analysis of input FASTQ files."
help_text: |
FastQC is a tool which provides quality control checks on raw sequencing data.
The pipeline will include the FastQC module.
nfcore_pipelines: True
custom_pipelines: True
changelog:
skippable_paths:
- "CHANGELOG.md"
Expand Down
11 changes: 5 additions & 6 deletions tests/modules/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from pathlib import Path
from typing import Union

import pytest
import yaml
from git.repo import Repo

Expand Down Expand Up @@ -191,8 +190,8 @@ def test_modules_lint_empty(self):
"""Test linting a pipeline with no modules installed"""
self.mods_remove.remove("fastqc", force=True)
self.mods_remove.remove("multiqc", force=True)
with pytest.raises(LookupError):
nf_core.modules.lint.ModuleLint(directory=self.pipeline_dir)
nf_core.modules.lint.ModuleLint(directory=self.pipeline_dir)
assert "No modules from https://github.com/nf-core/modules.git installed in pipeline" in self.caplog.text

def test_modules_lint_new_modules(self):
"""lint a new module"""
Expand All @@ -206,8 +205,8 @@ def test_modules_lint_no_gitlab(self):
"""Test linting a pipeline with no modules installed"""
self.mods_remove.remove("fastqc", force=True)
self.mods_remove.remove("multiqc", force=True)
with pytest.raises(LookupError):
nf_core.modules.lint.ModuleLint(directory=self.pipeline_dir, remote_url=GITLAB_URL)
nf_core.modules.lint.ModuleLint(directory=self.pipeline_dir, remote_url=GITLAB_URL)
assert f"No modules from {GITLAB_URL} installed in pipeline" in self.caplog.text

def test_modules_lint_gitlab_modules(self):
"""Lint modules from a different remote"""
Expand Down Expand Up @@ -566,7 +565,7 @@ def test_modules_meta_yml_input_mismatch(self):
fh.write(main_nf)
assert len(module_lint.failed) == 0, f"Linting failed with {[x.__dict__ for x in module_lint.failed]}"
assert len(module_lint.passed) >= 0
assert len(module_lint.warned) == 2
assert len(module_lint.warned) == 2, f"Linting warning with {[x.__dict__ for x in module_lint.warned]}"
lint_tests = [x.lint_test for x in module_lint.warned]
# check that it is there twice:
assert lint_tests.count("meta_input_meta_only") == 1
Expand Down
Loading

0 comments on commit 2eb5458

Please sign in to comment.