Skip to content
Draft
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
4 changes: 4 additions & 0 deletions data/allreads.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gut,https://raw.githubusercontent.com/nextflow-io/rnaseq-nf/refs/heads/master/data/ggal/ggal_gut_1.fq,https://raw.githubusercontent.com/nextflow-io/rnaseq-nf/refs/heads/master/data/ggal/ggal_gut_2.fq
liver,https://raw.githubusercontent.com/nextflow-io/rnaseq-nf/refs/heads/master/data/ggal/ggal_liver_1.fq,https://raw.githubusercontent.com/nextflow-io/rnaseq-nf/refs/heads/master/data/ggal/ggal_liver_2.fq
lung,https://raw.githubusercontent.com/nextflow-io/rnaseq-nf/refs/heads/master/data/ggal/ggal_lung_1.fq,https://raw.githubusercontent.com/nextflow-io/rnaseq-nf/refs/heads/master/data/ggal/ggal_lung_2.fq
spleen,https://raw.githubusercontent.com/nextflow-io/rnaseq-nf/refs/heads/master/data/ggal/ggal_spleen_1.fq,https://raw.githubusercontent.com/nextflow-io/rnaseq-nf/refs/heads/master/data/ggal/ggal_spleen_2.fq
1 change: 1 addition & 0 deletions data/gut.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gut,https://raw.githubusercontent.com/nextflow-io/rnaseq-nf/refs/heads/master/data/ggal/ggal_gut_1.fq,https://raw.githubusercontent.com/nextflow-io/rnaseq-nf/refs/heads/master/data/ggal/ggal_gut_2.fq
69 changes: 52 additions & 17 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@

/*
* Default pipeline parameters. They can be overriden on the command line eg.
* given `params.foo` specify on the run command line `--foo some_value`.
* given `params.reads` specify on the run command line `--reads some_value`.
*/

params.reads = "${baseDir}/data/ggal/ggal_gut_{1,2}.fq"
params.transcriptome = "${baseDir}/data/ggal/ggal_1_48850000_49020000.Ggal71.500bpflank.fa"
params.outdir = "results"
params.multiqc = "${baseDir}/multiqc"
params {
// The input read-pair files
reads: Path

// The input transcriptome file
transcriptome: Path

// Directory containing multiqc configuration
multiqc: Path = "${projectDir}/multiqc"
}


// import modules
Expand All @@ -24,28 +30,57 @@ include { MULTIQC } from './modules/multiqc'
* main script flow
*/
workflow {

main:
log.info """\
R N A S E Q - N F P I P E L I N E
===================================
transcriptome: ${params.transcriptome}
reads : ${params.reads}
outdir : ${params.outdir}
outdir : ${workflow.outputDir}
""".stripIndent()

read_pairs_ch = channel.fromFilePairs(params.reads, checkIfExists: true, flat: true)
read_pairs_ch = channel.fromPath(params.reads)
.flatMap { csv -> csv.splitCsv() }
.map { row -> row as Tuple<String,String,String> }
.map { id, fastq_1, fastq_2 ->
tuple(id, file(fastq_1, checkIfExists: true), file(fastq_2, checkIfExists: true))
}

samples_ch = RNASEQ(read_pairs_ch, params.transcriptome)

multiqc_files_ch = samples_ch
.flatMap { id, fastqc, quant -> [fastqc, quant].toSet() }
.collect()

(fastqc_ch, quant_ch) = RNASEQ(read_pairs_ch, params.transcriptome)
multiqc_report = MULTIQC(multiqc_files_ch, params.multiqc)

multiqc_files_ch = fastqc_ch.mix(quant_ch).collect()
publish:
samples = samples_ch.map { id, fastqc, quant -> [id: id, fastqc: fastqc, quant: quant] }
multiqc_report = multiqc_report

MULTIQC(multiqc_files_ch, params.multiqc)
onComplete:
log.info(
workflow.success
? "\nDone! Open the following report in your browser --> ${workflow.outputDir}/multiqc_report.html\n"
: "Oops .. something went wrong"
)
}

/*
* workflow outputs
*/
output {
samples: Channel<Map> {
path { sample ->
sample.fastqc >> "fastqc/${sample.id}"
sample.quant >> "quant/${sample.id}"
}
index {
path 'samples.csv'
header true
}
}

workflow.onComplete = {
log.info(
workflow.success
? "\nDone! Open the following report in your browser --> ${params.outdir}/multiqc_report.html\n"
: "Oops .. something went wrong"
)
multiqc_report: Path {
}
}
8 changes: 4 additions & 4 deletions modules/fastqc/main.nf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
params.outdir = 'results'

nextflow.preview.types = true

process FASTQC {
tag "${id}"
conda 'bioconda::fastqc=0.12.1'
publishDir params.outdir, mode: 'copy'

input:
tuple val(id), path(fastq_1), path(fastq_2)
(id, fastq_1, fastq_2): Tuple<String, Path, Path>

output:
path "fastqc_${id}_logs"
tuple(id, file("fastqc_${id}_logs"))

script:
"""
Expand Down
6 changes: 4 additions & 2 deletions modules/index/main.nf
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@

nextflow.preview.types = true

process INDEX {
tag "${transcriptome.simpleName}"
conda 'bioconda::salmon=1.10.3'

input:
path transcriptome
transcriptome: Path

output:
path 'index'
file('index')

script:
"""
Expand Down
10 changes: 5 additions & 5 deletions modules/multiqc/main.nf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
params.outdir = 'results'

nextflow.preview.types = true

process MULTIQC {
conda 'bioconda::multiqc=1.27.1'
publishDir params.outdir, mode: 'copy'

input:
path '*'
path config
logs: Set<Path>
config: Path

output:
path 'multiqc_report.html'
file('multiqc_report.html')

script:
"""
Expand Down
8 changes: 5 additions & 3 deletions modules/quant/main.nf
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@

nextflow.preview.types = true

process QUANT {
tag "${id}"
conda 'bioconda::salmon=1.10.3'

input:
tuple val(id), path(fastq_1), path(fastq_2)
path index
(id, fastq_1, fastq_2): Tuple<String, Path, Path>
index: Path

output:
path "quant_${id}"
tuple(id, file("quant_${id}"))

script:
"""
Expand Down
8 changes: 4 additions & 4 deletions modules/rnaseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ include { FASTQC } from './fastqc'

workflow RNASEQ {
take:
read_pairs_ch
transcriptome
read_pairs_ch: Channel<Tuple<String,Path,Path>>
transcriptome: Path

main:
index = INDEX(transcriptome)
fastqc_ch = FASTQC(read_pairs_ch)
quant_ch = QUANT(read_pairs_ch, index)
samples_ch = fastqc_ch.join(quant_ch)

emit:
fastqc = fastqc_ch
quant = quant_ch
samples: Channel<Tuple<String,Path,Path>> = samples_ch
}
36 changes: 12 additions & 24 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@
manifest {
description = 'Proof of concept of a RNA-seq pipeline implemented with Nextflow'
author = 'Paolo Di Tommaso'
nextflowVersion = '>=23.10.0'
nextflowVersion = '>=25.10.0'
}

/*
* default params
* params for default test data
*/

params.outdir = "results"
params.reads = "${projectDir}/data/ggal/ggal_gut_{1,2}.fq"
params.transcriptome = "${projectDir}/data/ggal/ggal_1_48850000_49020000.Ggal71.500bpflank.fa"
params.multiqc = "${projectDir}/multiqc"
params.reads = "${projectDir}/data/gut.csv"
params.transcriptome = "https://raw.githubusercontent.com/nextflow-io/rnaseq-nf/refs/heads/master/data/ggal/ggal_1_48850000_49020000.Ggal71.500bpflank.fa"

/*
* defines execution profiles for different environments
* publish settings
*/

workflow.output.mode = 'copy'

/*
* execution profiles for different environments
*/

profiles {
Expand All @@ -35,7 +39,7 @@ profiles {
}

'all-reads' {
params.reads = "${projectDir}/data/ggal/ggal_*_{1,2}.fq"
params.reads = "${projectDir}/data/allreads.csv"
}

arm64 {
Expand Down Expand Up @@ -83,8 +87,6 @@ profiles {
}

batch {
params.reads = 's3://rnaseq-nf/data/ggal/lung_{1,2}.fq'
params.transcriptome = 's3://rnaseq-nf/data/ggal/transcript.fa'
process.container = 'docker.io/nextflow/rnaseq-nf:v1.3.1'
process.executor = 'awsbatch'
process.queue = 'nextflow-ci'
Expand All @@ -93,15 +95,7 @@ profiles {
aws.batch.cliPath = '/home/ec2-user/miniconda/bin/aws'
}

's3-data' {
process.container = 'docker.io/nextflow/rnaseq-nf:v1.3.1'
params.reads = 's3://rnaseq-nf/data/ggal/lung_{1,2}.fq'
params.transcriptome = 's3://rnaseq-nf/data/ggal/transcript.fa'
}

'google-batch' {
params.transcriptome = 'gs://rnaseq-nf/data/ggal/transcript.fa'
params.reads = 'gs://rnaseq-nf/data/ggal/gut_{1,2}.fq'
params.multiqc = 'gs://rnaseq-nf/multiqc'
process.executor = 'google-batch'
process.container = 'docker.io/nextflow/rnaseq-nf:v1.3.1'
Expand All @@ -112,12 +106,6 @@ profiles {
google.region = 'europe-west2'
}

'gs-data' {
process.container = 'docker.io/nextflow/rnaseq-nf:v1.3.1'
params.transcriptome = 'gs://rnaseq-nf/data/ggal/transcript.fa'
params.reads = 'gs://rnaseq-nf/data/ggal/gut_{1,2}.fq'
}

'azure-batch' {
process.container = 'docker.io/nextflow/rnaseq-nf:v1.3.1'
workDir = 'az://nf-scratch/work'
Expand Down
Loading