Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
evanfloden authored Jun 24, 2019
2 parents a318369 + 869adfb commit e6ab498
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 32 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Nextflow training for the Bioinformatics Summer School 2019
# Nextflow training for Summer School in Bioinformatics 2019

## Nextflow in a nutshell

Expand Down Expand Up @@ -32,7 +32,7 @@ A workflow engine for data analysis pipelines with a strong focus on enabling:
Install Nextflow by using the following command:

```
curl -fsSL https://get.nextflow.io | bash
wget -qO- https://get.nextflow.io | bash
```

The above snippet creates the `nextflow` launcher in the current directory.
Expand All @@ -52,7 +52,7 @@ conda install nextflow
Then, clone this repository with the following command:

```
git clone https://github.com/cbcrg/nf-summerschool && cd cbcrg/nf-summerschool
git clone https://github.com/cbcrg/nf-summerschool.git && cd nf-summerschool
```

Finally pull the following Docker container:
Expand Down Expand Up @@ -92,10 +92,11 @@ that will be used as the pipeline output directory.

#### Exercise 1.2

Modify the `script1.nf` to print all the pipeline parameters by using a single `println` command and a [multiline string](https://www.nextflow.io/docs/latest/script.html#multi-line-strings)
Modify the `script1.nf` to print all the pipeline parameters using `log.info` instead
of the `println` command and a [multiline string](https://www.nextflow.io/docs/latest/script.html#multi-line-strings)
statement.

Tip: see an example [here](https://github.com/nextflow-io/rnaseq-nf/blob/3b5b49f/main.nf#L41-L48).
Tip: see an example [here](https://github.com/nextflow-io/rnaseq-nf/blob/42974a2/main.nf#L34-L40).

#### Recap

Expand All @@ -105,6 +106,7 @@ In this step you have learned:
2. How to pass parameters by using the command line
3. The use of `$var` and `${var}` variable placeholders
4. How to use multiline strings
5. How to use `log.info` to report values


### Step 2 - Create transcriptome index file
Expand Down Expand Up @@ -153,8 +155,7 @@ Enable the Docker execution by default adding the above setting in the `nextflow

#### Exercise 2.2

Print the output of the `index_ch` channel by using the [println](https://www.nextflow.io/docs/latest/operator.html#println)
operator (do not confuse it with the `println` statement seen previously).
Print the output of the `index_ch` channel by using the [view](https://www.nextflow.io/docs/latest/operator.html#view) operator.

#### Exercise 2.3

Expand All @@ -178,7 +179,7 @@ This step shows how to match *read* files into pairs, so they can be mapped by *
Edit the script `script3.nf` and add the following statement as the last line:

```
read_pairs_ch.println()
read_pairs_ch.view()
```

Save it and execute it with the following command:
Expand Down Expand Up @@ -210,17 +211,16 @@ of `=` assignment to define the `read_pairs_ch` channel.

#### Exercise 3.2

Use the [ifEmpty](https://www.nextflow.io/docs/latest/operator.html#ifempty) operator
to check if the `read_pairs_ch` contains at least an item.
Use the `checkIfExists` for the [fromFilePairs](https://www.nextflow.io/docs/latest/channel.html#fromfilepairs) method to make sure it returns some file pairs.


#### Recap

In this step you have learned:

1. How to use `fromFilePairs` to handle read pair files
2. How to use the `set` operator to define a new channel variable
3. How to use the `ifEmpty` operator to check if a channel is empty
1. How to use `fromFilePairs` to handle read pair files.
2. How to use the `set` operator to define a new channel variable.
3. How to use the `checkIfExists` option.


### Step 4 - Perform expression quantification
Expand Down
2 changes: 1 addition & 1 deletion script2.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ params.transcriptome = "$baseDir/data/ggal/transcriptome.fa"
params.multiqc = "$baseDir/multiqc"
params.outdir = "results"

println """\
log.info """\
R N A S E Q - N F P I P E L I N E
===================================
transcriptome: ${params.transcriptome}
Expand Down
2 changes: 1 addition & 1 deletion script3.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ params.transcriptome = "$baseDir/data/ggal/transcriptome.fa"
params.multiqc = "$baseDir/multiqc"
params.outdir = "results"

println """\
log.info """\
R N A S E Q - N F P I P E L I N E
===================================
transcriptome: ${params.transcriptome}
Expand Down
7 changes: 3 additions & 4 deletions script4.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ params.transcriptome = "$baseDir/data/ggal/transcriptome.fa"
params.multiqc = "$baseDir/multiqc"
params.outdir = "results"

println """\
log.info """\
R N A S E Q - N F P I P E L I N E
===================================
transcriptome: ${params.transcriptome}
Expand Down Expand Up @@ -40,8 +40,7 @@ process index {


Channel
.fromFilePairs( params.reads )
.ifEmpty { error "Oops! Cannot find any file matching: ${params.reads}" }
.fromFilePairs( params.reads, checkIfExists:true )
.set { read_pairs_ch }

process quantification {
Expand All @@ -55,7 +54,7 @@ process quantification {

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 ${reads[0]} -2 ${reads[1]} -o $pair_id
"""
}

7 changes: 3 additions & 4 deletions script5.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ params.transcriptome = "$baseDir/data/ggal/transcriptome.fa"
params.multiqc = "$baseDir/multiqc"
params.outdir = "results"

println """\
log.info """\
R N A S E Q - N F P I P E L I N E
===================================
transcriptome: ${params.transcriptome}
Expand Down Expand Up @@ -40,8 +40,7 @@ process index {


Channel
.fromFilePairs( params.reads )
.ifEmpty { error "Oops! Cannot find any file matching: ${params.reads}" }
.fromFilePairs( params.reads, checkIfExists:true )
.set { read_pairs_ch }

process quantification {
Expand All @@ -55,7 +54,7 @@ process quantification {

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 ${reads[0]} -2 ${reads[1]} -o $pair_id
"""
}

Expand Down
7 changes: 3 additions & 4 deletions script6.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ params.transcriptome = "$baseDir/data/ggal/transcriptome.fa"
params.multiqc = "$baseDir/multiqc"
params.outdir = "results"

println """\
log.info """\
R N A S E Q - N F P I P E L I N E
===================================
transcriptome: ${params.transcriptome}
Expand Down Expand Up @@ -40,8 +40,7 @@ process index {


Channel
.fromFilePairs( params.reads )
.ifEmpty { error "Oops! Cannot find any file matching: ${params.reads}" }
.fromFilePairs( params.reads, checkIfExists:true )
.into { read_pairs_ch; read_pairs2_ch }

process quantification {
Expand All @@ -56,7 +55,7 @@ process quantification {

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 ${reads[0]} -2 ${reads[1]} -o $pair_id
"""
}

Expand Down
9 changes: 4 additions & 5 deletions script7.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ params.transcriptome = "$baseDir/data/ggal/transcriptome.fa"
params.multiqc = "$baseDir/multiqc"
params.outdir = "results"

println """\
log.info """\
R N A S E Q - N F P I P E L I N E
===================================
transcriptome: ${params.transcriptome}
Expand Down Expand Up @@ -40,8 +40,7 @@ process index {


Channel
.fromFilePairs( params.reads )
.ifEmpty { error "Oops! Cannot find any file matching: ${params.reads}" }
.fromFilePairs( params.reads, checkIfExists:true )
.into { read_pairs_ch; read_pairs2_ch }

process quantification {
Expand All @@ -56,7 +55,7 @@ process quantification {

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 ${reads[0]} -2 ${reads[1]} -o $pair_id
"""
}

Expand Down Expand Up @@ -95,5 +94,5 @@ process multiqc {


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

0 comments on commit e6ab498

Please sign in to comment.