Commit 5a6a22f8 authored by Celine Noirot's avatar Celine Noirot
Browse files

Add multiQc and samplesheet

parent f0a9708a
# nf-core/template: Output
This document describes the output produced by the pipeline. Most of the plots are taken from the MultiQC report, which summarises results at the end of the pipeline.
<!-- TODO nf-core: Write this documentation describing your workflow's output -->
## Pipeline overview
The pipeline is built using [Nextflow](https://www.nextflow.io/)
and processes data using the following steps:
* [FastQC](#fastqc) - read quality control
* [MultiQC](#multiqc) - aggregate report, describing results of the whole pipeline
## FastQC
[FastQC](http://www.bioinformatics.babraham.ac.uk/projects/fastqc/) gives general quality metrics about your reads. It provides information about the quality score distribution across your reads, the per base sequence content (%T/A/G/C). You get information about adapter contamination and other overrepresented sequences.
For further reading and documentation see the [FastQC help](http://www.bioinformatics.babraham.ac.uk/projects/fastqc/Help/).
> **NB:** The FastQC plots displayed in the MultiQC report shows _untrimmed_ reads. They may contain adapter sequence and potentially regions with low quality. To see how your reads look after trimming, look at the FastQC reports in the `trim_galore` directory.
**Output directory: `results/fastqc`**
* `sample_fastqc.html`
* FastQC report, containing quality metrics for your untrimmed raw fastq files
* `zips/sample_fastqc.zip`
* zip file containing the FastQC report, tab-delimited data file and plot images
## MultiQC
[MultiQC](http://multiqc.info) is a visualisation tool that generates a single HTML report summarising all samples in your project. Most of the pipeline QC results are visualised in the report and further statistics are available in within the report data directory.
The pipeline has special steps which allow the software versions used to be reported in the MultiQC output for future traceability.
**Output directory: `results/multiqc`**
* `Project_multiqc_report.html`
* MultiQC report - a standalone HTML file that can be viewed in your web browser
* `Project_multiqc_data/`
* Directory containing parsed statistics from the different tools used in the pipeline
For more information about how to use MultiQC reports, see [http://multiqc.info](http://multiqc.info)
......@@ -85,51 +85,40 @@ if (params.help) {
//
inputDirCh = Channel.fromPath(params.inputdir, checkIfExists: true) : Channel.empty()
if (! params.samplesheet){
params.samplesheet = params.inputdir + "/samples.csv"
}
samplesheetCh = Channel.fromPath(params.samplesheet, checkIfExists: true) : Channel.empty()
ch_inputdir = params.inputdir ? Channel.fromPath(params.inputdir, checkIfExists: true) : Channel.empty()
// Create a channel for input read files
if(params.samplesheet){
if(params.singleEnd){
if(params.single_end){
Channel
.from(file("${params.samplePlan}"))
.from(file("${params.samplesheet}"))
.splitCsv(header: false)
.map{ row -> [ row[0], [file(row[2])]] }
.set { rawReadsFastqcCh }
.into { ch_read_files_for_fastqc; ch_read_files_for_qc1; ch_read_files_for_assembly}
}else{
Channel
.from(file("${params.samplePlan}"))
.from(file("${params.samplesheet}"))
.splitCsv(header: false)
.map{ row -> [ row[0], [file(row[2]), file(row[3])]] }
.set { rawReadsFastqcCh }
.into { ch_read_files_for_fastqc; ch_read_files_for_qc1; ch_read_files_for_assembly}
}
params.reads=false
}
else if(params.readPaths){
if(params.singleEnd){
Channel
.from(params.readPaths)
.map { row -> [ row[0], [file(row[1][0])]] }
.ifEmpty { exit 1, "params.readPaths was empty - no input files supplied." }
.set { rawReadsFastqcCh }
} else {
Channel
.from(params.readPaths)
.map { row -> [ row[0], [file(row[1][0]), file(row[1][1])]] }
.ifEmpty { exit 1, "params.readPaths was empty - no input files supplied." }
.set { rawReadsFastqcCh }
}
} else {
Channel
.fromFilePairs( params.reads, size: params.singleEnd ? 1 : 2 )
.ifEmpty { exit 1, "Cannot find any reads matching: ${params.reads}\nNB: Path needs to be enclosed in quotes!\nNB: Path requires at least one * wildcard!\nIf this is single-end data, please specify --singleEnd on the command line." }
.set { rawReadsFastqcCh }
exit 1, "Expect a samplesheet and an input dir !"
}
/*
* SET UP CONFIGURATION VARIABLES
*/
// Has the run name been specified by the user?
// this has the bonus effect of catching both -name and --name
custom_runName = params.name
if (!(workflow.runName ==~ /[a-z]+_[a-z]+/)) {
custom_runName = workflow.runName
}
// Stage config files
ch_multiqc_config = file(params.multiqc_config, checkIfExists: true)
ch_output_docs = file("$projectDir/docs/output.md", checkIfExists: true)
ch_output_docs_images = file("$projectDir/docs/images/", checkIfExists: true)
/* In case of modular pipeline*/
params.step = "qc"
......@@ -157,10 +146,10 @@ process fastqc {
saveAs: { filename -> filename.indexOf(".zip") > 0 ? "zips/$filename" : "$filename" }
input:
set val(name), file(reads) from read_files_fastqc
set val(name), file(reads) from ch_read_files_for_fastqc
output:
file "*_fastqc.{zip,html}" into fastqc_results
file "*_fastqc.{zip,html}" into fastqc_results_for_multiqc
script:
"""
......@@ -173,16 +162,16 @@ process fastqc {
*/
process qc1 {
input:
set replicateId, file(reads) from raw_reads_fastqc
set replicate_id, file(reads) from ch_read_files_for_qc1
output:
file("${replicateId}.qc1") into fastqc_raw_ch_for_multiqc
file("${replicate_id}.qc1") into ch_fastqc_raw_for_assembly
when: "qc" in step
script:
"""
echo "mkdir ${replicateId} ; fastqc --nogroup --quiet -o ${replicateId} --threads ${task.cpus} ${reads[0]} ${reads[1]}" > ${replicateId}.qc1
echo "mkdir ${replicate_id} ; fastqc --nogroup --quiet -o ${replicate_id} --threads ${task.cpus} ${reads[0]} ${reads[1]}" > ${replicate_id}.qc1
"""
}
......@@ -191,17 +180,47 @@ process qc1 {
*/
process assembly {
input:
set file (qc) from fastqc_raw_ch_for_multiqc
set replicateId, file(reads) from raw_reads_assembly
file (qc) from ch_fastqc_raw_for_assembly
set replicate_id, file(reads) from ch_read_files_for_assembly
output:
file("${replicateId}.assembly") into assembly_ch
file("${replicate_id}.assembly") into ch_assembly_for_multiqc
when: "assembly" in step
script:
"""
echo "ASSEMBLY ${replicateId} ; " > ${replicateId}.assembly
echo "ASSEMBLY ${replicate_id} ; " > ${replicate_id}.assembly
"""
}
/***********
* MultiQC *
***********/
process multiqc {
publishDir "${params.outdir}/MultiQC", mode: 'copy'
when:
!params.skip_multiQC
input:
file (multiqc_config) from ch_multiqc_config
file ('fastqc/*') from fastqc_results_for_multiqc.collect().ifEmpty([])
// TODO nf-core: Add in log files from your new processes for MultiQC to find!
//file ('softwareVersions/*') from softwareVersionsYamlCh.collect().ifEmpty([])
//file ('workflowSummary/*') from workflowSummaryYamlCh.collect()
output:
file "*report.html" into ch_multiqc_report
file "*_data"
file "multiqc_plots"
script:
rtitle = custom_runName ? "--title \"$custom_runName\"" : ''
rfilename = custom_runName ? "--filename " + custom_runName.replaceAll('\\W','_').replaceAll('_+','_') + "_multiqc_report" : ''
"""
multiqc -f $rtitle $rfilename --config $multiqc_config .
"""
}
......@@ -10,9 +10,9 @@ params {
// Workflow flags
// TODO nf-core: Specify your pipeline's command line flags
genome = false
reads = "data/*{1,2}.fastq.gz"
singleEnd = false
inputdir = "./data"
samplesheet = "${params.inputdir}/samples.csv"
single_end = false
outdir = './results'
// Boilerplate options
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment