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

Dev - Adding FastQC to the pipeline, with integration into MultiQC #121

Merged
merged 7 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
14 changes: 14 additions & 0 deletions docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The pipeline is built using [Nextflow](https://www.nextflow.io/) and processes d
- [:warning: Please read this documentation on the nf-core website: https://nf-co.re/scrnaseq/output](#warning-please-read-this-documentation-on-the-nf-core-website-httpsnf-corescrnaseqoutput)
- [Introduction](#introduction)
- [Pipeline overview](#pipeline-overview)
- [FastQC](#fastqc)
- [Kallisto & Bustools Results](#kallisto--bustools-results)
- [STARsolo](#starsolo)
- [Salmon Alevin & AlevinQC](#salmon-alevin--alevinqc)
Expand All @@ -20,6 +21,19 @@ The pipeline is built using [Nextflow](https://www.nextflow.io/) and processes d
- [MultiQC](#multiqc)
- [Pipeline information](#pipeline-information)

## FastQC

See [FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc) for details about FastQC.

The pipeline analyzes the raw data and generates for each file a FastQC report. All report are collected in MultiQC.

**Output directory: `results/fastqc`**

- `.html`
- Contains the FastQC report.
- `.zip`
- Contains additional information, such as individual plots, and FastQC raw data.

## Kallisto & Bustools Results

See [Kallisto](https://pachterlab.github.io/kallisto/about) for details about Kallisto and [Bustools](https://bustools.github.io/) for more information on BusTools.
Expand Down
35 changes: 22 additions & 13 deletions modules/local/multiqc.nf
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
process MULTIQC {
label 'process_medium'

conda (params.enable_conda ? "bioconda::multiqc=1.10.1" : null)
conda (params.enable_conda ? 'bioconda::multiqc=1.11' : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/multiqc:1.10.1--py_0' :
'quay.io/biocontainers/multiqc:1.10.1--py_0' }"
'https://depot.galaxyproject.org/singularity/multiqc:1.11--pyhdfd78af_0' :
'quay.io/biocontainers/multiqc:1.11--pyhdfd78af_0' }"

input:
path 'multiqc_config.yaml'
path multiqc_custom_config
path software_versions
path ch_multiqc_config
path ch_multiqc_custom_config
path software_versions_yaml
path workflow_summary
path ('fastqc/*')
path ("STAR/*")
path ("salmon_alevin/*")

output:
path "*multiqc_report.html" , emit: report
path "*_data" , emit: data
path "*variants_metrics_mqc.csv", optional:true, emit: csv_variants
path "*assembly_metrics_mqc.csv", optional:true, emit: csv_assembly
path "*_plots" , optional:true, emit: plots
path "*multiqc_report.html", emit: report
path "*_data" , emit: data
path "*_plots" , optional:true, emit: plots
path "versions.yml" , emit: versions

script:
def custom_config = params.multiqc_config ? "--config $multiqc_custom_config" : ''
def args = task.ext.args ?: ''
def custom_config = params.multiqc_config ? "--config $multiqc_custom_config" : ''
"""
multiqc -f $args $custom_config .
multiqc \\
-f \\
$args \\
$custom_config \\
.

cat <<-END_VERSIONS > versions.yml
"${task.process}":
multiqc: \$( multiqc --version | sed -e "s/multiqc, version //g" )
END_VERSIONS
"""
}
3 changes: 2 additions & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ params {
igenomes_base = 's3://ngi-igenomes/igenomes'
igenomes_ignore = false

// MultiQC options
// QC and MultiQC options
skip_fastqc = false
multiqc_config = null
multiqc_title = null
max_multiqc_email_size = '25.MB'
Expand Down
4 changes: 4 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@
"hidden": true,
"fa_icon": "fas fa-bacon"
},
"skip_fastqc": {
"type": "boolean",
"description": "Skip the FastQC reporting feature in the pipeline."
},
"skip_multiqc": {
"type": "boolean",
"description": "Skip the MultiQC reporting feature in the pipeline."
Expand Down
45 changes: 45 additions & 0 deletions subworkflows/local/fastqc.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// Check input samplesheet and get read channels
//

//TODO --> add skip_fastqc to params
apeltzer marked this conversation as resolved.
Show resolved Hide resolved

include { FASTQC } from '../../modules/nf-core/modules/fastqc/main'

workflow FASTQC_CHECK {
take:
ch_fastq

main:
ch_fastq
.map { ch -> [ ch[0], ch[1] ] }
.set { ch_fastq }

/*
* FastQ QC using FASTQC
*/
fastqc_zip = Channel.empty()
fastqc_html = Channel.empty()
fastqc_multiqc = Channel.empty()
fastqc_version = Channel.empty()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, some are obsolete, which came from old code.


FASTQC ( ch_fastq )
fastqc_zip = FASTQC.out.zip
fastqc_html = FASTQC.out.html

fastqc_zip
.map { it -> [ it[1] ] }
.set { fastqc_zip_only }
fastqc_html
.map { it -> [ it[1] ] }
.set { fastqc_html_only }

fastqc_multiqc = fastqc_multiqc.mix( fastqc_zip_only, fastqc_html_only )
fastqc_version = FASTQC.out.versions

emit:
fastqc_zip
fastqc_html
fastqc_version
fastqc_multiqc
}
13 changes: 12 additions & 1 deletion workflows/scrnaseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath(params.multi
// SUBWORKFLOW: Consisting of a mix of local and nf-core/modules
//
include { INPUT_CHECK } from '../subworkflows/local/input_check'
include { FASTQC_CHECK } from '../subworkflows/local/fastqc'
include { KALLISTO_BUSTOOLS } from '../subworkflows/local/kallisto_bustools'
include { SCRNASEQ_ALEVIN } from '../subworkflows/local/alevin'
include { STARSOLO } from '../subworkflows/local/starsolo'
Expand Down Expand Up @@ -105,6 +106,14 @@ workflow SCRNASEQ {

ch_versions = ch_versions.mix(INPUT_CHECK.out.versions)

// Run FastQC
ch_multiqc_fastqc = Channel.empty()
if (!params.skip_fastqc){
FASTQC_CHECK ( ch_fastq )
ch_versions = ch_versions.mix(FASTQC_CHECK.out.fastqc_version.first().ifEmpty(null))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is .first().ifEmpty(null) required?

We currently don't have it anywhere else for the versions and there should always be a version file emitted...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed it

ch_multiqc_fastqc = FASTQC_CHECK.out.fastqc_multiqc.ifEmpty([])
}

// Run kallisto bustools pipeline
if (params.aligner == "kallisto") {
KALLISTO_BUSTOOLS(
Expand Down Expand Up @@ -169,15 +178,17 @@ workflow SCRNASEQ {
)

if (!params.skip_multiqc) {

ch_workflow_summary = Channel.value(
WorkflowScrnaseq.paramsSummaryMultiqc(workflow, summary_params)
).collectFile(name: 'workflow_summary_mqc.yaml')

MULTIQC(
ch_multiqc_config,
ch_multiqc_custom_config,
ch_multiqc_custom_config.collect().ifEmpty([]),
CUSTOM_DUMPSOFTWAREVERSIONS.out.mqc_yml.collect(),
ch_workflow_summary,
ch_multiqc_fastqc.collect{it[0]}.ifEmpty([]),
ch_multiqc_alevin,
ch_multiqc_star
)
Expand Down