Skip to content

Commit

Permalink
Update to second preview
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <[email protected]>
  • Loading branch information
bentsherman committed Oct 29, 2024
1 parent 267981b commit 642dbad
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 33 deletions.
43 changes: 29 additions & 14 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ params.transcriptome = "$baseDir/data/ggal/ggal_1_48850000_49020000.Ggal71.500bp
params.outdir = "results"
params.multiqc = "$baseDir/multiqc"

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}
"""

// import modules
include { RNASEQ } from './modules/rnaseq'
include { MULTIQC } from './modules/multiqc'
Expand All @@ -53,17 +45,40 @@ include { MULTIQC } from './modules/multiqc'
* main script flow
*/
workflow {
read_pairs_ch = channel.fromFilePairs( params.reads, checkIfExists: true )
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}
"""

read_pairs_ch = channel.fromFilePairs( params.reads, checkIfExists: true, flat: true )
RNASEQ( params.transcriptome, read_pairs_ch )
MULTIQC( RNASEQ.out, params.multiqc )

samples_ch = RNASEQ.out.quant
| join(RNASEQ.out.fastqc)

multiqc_ch = RNASEQ.out.quant
| concat(RNASEQ.out.fastqc)
| map { _id, file -> file }
| collect
MULTIQC( multiqc_ch, params.multiqc )

publish:
samples_ch >> 'samples'
MULTIQC.out >> 'multiqc'
}

output {
directory params.outdir
mode 'copy'
fastqc {
samples {
path '.'
index {
path 'index.csv'
path 'index.json'
mapper { id, quant, fastqc ->
[id: id, quant: quant, fastqc: fastqc]
}
}
}
}
11 changes: 4 additions & 7 deletions modules/fastqc/main.nf
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@

process FASTQC {
tag "FASTQC on $sample_id"
tag "$sample_id"
conda 'fastqc=0.12.1'

input:
tuple val(sample_id), path(reads)
tuple val(sample_id), path(fastq_1), path(fastq_2)

output:
path "fastqc_${sample_id}_logs", emit: logs

publish:
logs >> 'fastqc'
tuple val(sample_id), path("fastqc_${sample_id}_logs"), emit: logs

script:
"""
fastqc.sh "$sample_id" "$reads"
fastqc.sh "$sample_id" "$fastq_1 $fastq_2"
"""
}
3 changes: 0 additions & 3 deletions modules/multiqc/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ process MULTIQC {
output:
path('multiqc_report.html'), emit: report

publish:
report >> 'multiqc'

script:
"""
cp $config/* .
Expand Down
10 changes: 5 additions & 5 deletions modules/quant/main.nf
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

process QUANT {
tag "$pair_id"
tag "$sample_id"
conda 'salmon=1.10.2'

input:
path index
tuple val(pair_id), path(reads)
path index
tuple val(sample_id), path(fastq_1), path(fastq_2)

output:
path pair_id
tuple val(sample_id), path(sample_id)

script:
"""
salmon quant --threads $task.cpus --libType=U -i $index -1 ${reads[0]} -2 ${reads[1]} -o $pair_id
salmon quant --threads $task.cpus --libType=U -i $index -1 ${fastq_1} -2 ${fastq_2} -o $sample_id
"""
}
9 changes: 5 additions & 4 deletions modules/rnaseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ workflow RNASEQ {
take:
transcriptome
read_pairs_ch
main:

main:
INDEX(transcriptome)
FASTQC(read_pairs_ch)
QUANT(INDEX.out, read_pairs_ch)

emit:
QUANT.out | concat(FASTQC.out) | collect
emit:
quant = QUANT.out
fastqc = FASTQC.out
}

0 comments on commit 642dbad

Please sign in to comment.