Skip to content

Commit

Permalink
Updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
pditommaso committed Sep 16, 2019
1 parent 8677cba commit 64a991a
Show file tree
Hide file tree
Showing 15 changed files with 249 additions and 59 deletions.
13 changes: 13 additions & 0 deletions fun-library.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def getInputForRnaseq( transcriptsPath, readsPath ) {

def separateTranscriptFromReads = forkCriteria({ tuple ->
trascript: tuple[0]
reads: [ tuple[1], tuple[2] ]
})

def reads = Channel.fromFilePairs(readsPath)
Channel.fromPath(transcriptsPath) \
| combine( reads ) \
| fork(separateTranscriptFromReads)

}
2 changes: 1 addition & 1 deletion main1.nf
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ process multiqc {
publishDir params.outdir, mode:'copy'

input:
path '*' from quant_ch.mix(fastqc_ch).collect()
path 'data*/*' from quant_ch.mix(fastqc_ch).collect()
path config from params.multiqc

output:
Expand Down
4 changes: 2 additions & 2 deletions main10.nf
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ log.info """\
include './rnaseq-analysis' params(params)

workflow rnaseqForTranscrip1 {
'rnaseq-analysis'(
rnaseq_analysis (
params.transcript1,
Channel .fromFilePairs( params.reads, checkExists: true ) )
}

workflow rnaseqForTranscrip2 {
'rnaseq-analysis'(
rnaseq_analysis (
params.transcript2,
Channel .fromFilePairs( params.reads, checkExists: true ) )
}
Expand Down
20 changes: 2 additions & 18 deletions main11.nf
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,8 @@ log.info """\

include './rnaseq-analysis' params(params)

workflow rnaseqForTranscrip1 {
'rnaseq-analysis'(
params.transcript1,
Channel .fromFilePairs( params.reads, checkExists: true ) )
}

workflow rnaseqForTranscrip2 {
'rnaseq-analysis'(
params.transcript2,
Channel .fromFilePairs( params.reads, checkExists: true ) )
}

workflow manyTranscript {
workflow {
reads = Channel .fromFilePairs( 'data/ggal/ggal_*_{1,2}.fq' )
transcripts = Channel.fromPath('data/ggal/transcriptome_*.fa')
transcripts
Expand All @@ -66,12 +55,7 @@ workflow manyTranscript {
}
.set { fork_out }

'rnaseq-analysis'(fork_out)
}

workflow {
rnaseqForTranscrip1()
rnaseqForTranscrip2()
rnaseq_analysis(fork_out)
}

workflow.onComplete {
Expand Down
13 changes: 0 additions & 13 deletions main12.nf
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,6 @@ log.info """\

include './rnaseq-analysis' params(params)

workflow rnaseqForTranscrip1 {
rnaseq_analysis (
params.transcript1,
Channel .fromFilePairs( params.reads, checkExists: true ) )
}

workflow rnaseqForTranscrip2 {
rnaseq_analysis (
params.transcript2,
Channel .fromFilePairs( params.reads, checkExists: true ) )
}



workflow {

Expand Down
17 changes: 2 additions & 15 deletions main13.nf
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@ log.info """\

include './rnaseq-analysis' params(params)

workflow rnaseqForTranscrip1 {
rnaseq_analysis (
params.transcript1,
Channel .fromFilePairs( params.reads, checkExists: true ) )
}

workflow rnaseqForTranscrip2 {
rnaseq_analysis (
params.transcript2,
Channel .fromFilePairs( params.reads, checkExists: true ) )
}



workflow {
Expand All @@ -63,14 +51,13 @@ workflow {
trascript: tuple[0]
reads: [ tuple[1], tuple[2] ]
})
Channel .fromFilePairs( 'data/ggal/ggal_*_{1,2}.fq' ).set {reads}

Channel.fromFilePairs( 'data/ggal/ggal_*_{1,2}.fq' ).set {reads}
Channel.fromPath('data/ggal/transcriptome_*.fa') \
| combine( reads ) \
| fork(separateTranscriptFromReads) \
| rnaseq_analysis


}

workflow.onComplete {
Expand Down
66 changes: 66 additions & 0 deletions main14.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright (c) 2013-2019, Centre for Genomic Regulation (CRG).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This Source Code Form is "Incompatible With Secondary Licenses", as
* defined by the Mozilla Public License, v. 2.0.
*
*/


/*
* Proof of concept of a RNAseq pipeline implemented with Nextflow
*
* Authors:
* - Paolo Di Tommaso <[email protected]>
* - Emilio Palumbo <[email protected]>
* - Evan Floden <[email protected]>
*/
nextflow.preview.dsl=2

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

params.reads = "$baseDir/data/ggal/ggal_gut_{1,2}.fq"
params.transcripts = "$baseDir/data/ggal/transcriptome_*.fa"
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
===================================
transcript1 : ${params.transcript1}
transcript2 : ${params.transcript2}
reads : ${params.reads}
outdir : ${params.outdir}
"""

include './rnaseq-analysis' params(params)


def getInputForRnaseq( transcriptsPath, readsPath ) {

def separateTranscriptFromReads = forkCriteria({ tuple ->
trascript: tuple[0]
reads: [ tuple[1], tuple[2] ]
})

def reads = Channel.fromFilePairs(readsPath)
Channel.fromPath(transcriptsPath) \
| combine( reads ) \
| fork(separateTranscriptFromReads)

}

workflow {
getInputForRnaseq(params.transcripts, params.reads) | rnaseq_analysis
}

workflow.onComplete {
log.info ( workflow.success ? "\nDone! Open the following report in your browser --> $params.outdir/multiqc_report.html\n" : "Oops .. something went wrong" )
}
57 changes: 57 additions & 0 deletions main15.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2013-2019, Centre for Genomic Regulation (CRG).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This Source Code Form is "Incompatible With Secondary Licenses", as
* defined by the Mozilla Public License, v. 2.0.
*
*/


/*
* Proof of concept of a RNAseq pipeline implemented with Nextflow
*
* Authors:
* - Paolo Di Tommaso <[email protected]>
* - Emilio Palumbo <[email protected]>
* - Evan Floden <[email protected]>
*/
nextflow.preview.dsl=2

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

params.reads = "$baseDir/data/ggal/ggal_gut_{1,2}.fq"
params.transcripts = "$baseDir/data/ggal/transcriptome_*.fa"
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
===================================
transcript1 : ${params.transcript1}
transcript2 : ${params.transcript2}
reads : ${params.reads}
outdir : ${params.outdir}
"""

include './rnaseq-analysis-2' params(params)
include './fun-library'

workflow {
main:
getInputForRnaseq(params.transcripts, params.reads) | rnaseq_analysis
publish:
rnaseq_analysis.out.fastqc to: 'results/fastqc_files'
rnaseq_analysis.out.quant to: 'results/quant_files'
rnaseq_analysis.out.multiqc to: 'results/multiqc_report'
}

workflow.onComplete {
log.info ( workflow.success ? "\nDone! Open the following report in your browser --> $params.outdir/multiqc_report.html\n" : "Oops .. something went wrong" )
}
2 changes: 1 addition & 1 deletion main2.nf
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ process multiqc {
publishDir params.outdir, mode:'copy'

input:
path '*' from quant_ch.mix(fastqc_ch).collect()
path 'data*/*' from quant_ch.mix(fastqc_ch).collect()
path config from params.multiqc

output:
Expand Down
4 changes: 2 additions & 2 deletions main3.nf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ log.info """\

Channel
.fromFilePairs( params.reads, checkExists:true )
.into { read_pairs_ch; read_pairs2_ch }
.set{ read_pairs_ch }


process index {
Expand Down Expand Up @@ -100,7 +100,7 @@ process multiqc {
publishDir params.outdir, mode:'copy'

input:
path '*'
path 'data*/*'
path config

output:
Expand Down
6 changes: 3 additions & 3 deletions main4.nf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ log.info """\

Channel
.fromFilePairs( params.reads, checkExists:true )
.into { read_pairs_ch; read_pairs2_ch }
.set{ read_pairs_ch }


process index {
Expand Down Expand Up @@ -100,7 +100,7 @@ process multiqc {
publishDir params.outdir, mode:'copy'

input:
path '*'
path 'data*/*'
path config

output:
Expand All @@ -119,7 +119,7 @@ workflow {

quant( index.out, read_pairs_ch )

fastqc( read_pairs2_ch )
fastqc( read_pairs_ch )

multiqc(
quant.out.mix(fastqc.out).collect(),
Expand Down
2 changes: 1 addition & 1 deletion main8.nf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ include './rnaseq-analysis' params(params)


workflow {
'rnaseq-analysis'(
rnaseq_analysis (
params.transcriptome,
Channel .fromFilePairs( params.reads, checkExists: true ) )
}
Expand Down
6 changes: 3 additions & 3 deletions main9.nf
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ log.info """\
include './rnaseq-analysis' params(params)

workflow rnaseqForTranscrip1 {
'rnaseq-analysis'(
rnaseq_analysis (
params.transcriptome,
Channel .fromFilePairs( params.reads, checkExists: true ) )
}

workflow rnaseqForTranscrip2 {
'rnaseq-analysis'(
rnaseq_analysis (
params.transcriptome,
Channel .fromFilePairs( params.reads, checkExists: true ) )
}

workflow {
'rnaseq-analysis'(
rnaseq_analysis (
params.transcriptome,
Channel .fromFilePairs( params.reads, checkExists: true ) )
}
Expand Down
30 changes: 30 additions & 0 deletions rnaseq-analysis-2.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
nextflow.preview.dsl=2

include index from './rnaseq-processes-2' params(params)
include quant from './rnaseq-processes-2' params(params)
include fastqc from './rnaseq-processes-2' params(params)
include multiqc from './rnaseq-processes-2' params(params)


workflow rnaseq_analysis {
get:
transcriptome
read_pairs_ch

main:
index( transcriptome )

quant( index.out, read_pairs_ch )

fastqc( read_pairs_ch )

multiqc(
quant.out.mix(fastqc.out).collect(),
params.multiqc )

emit:
quant = quant.out
fastqc = fastqc.out
multiqc = multiqc.out
}

Loading

0 comments on commit 64a991a

Please sign in to comment.