Skip to content

Commit eee0549

Browse files
authored
Merge branch 'master' into nf_test_genomics_test
2 parents 49f56fb + 99df8a2 commit eee0549

File tree

8 files changed

+42
-58
lines changed

8 files changed

+42
-58
lines changed

docs/hello_nextflow/02_hello_channels.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ Here we added the operator on the next line for readability, but you can add ope
522522

523523
#### 3.2.2. Add `view()` to inspect channel contents
524524

525-
We could run this right away to test if it works, but while we're at it, we're also going to add a couple of [`view()`](https://www.nextflow.io/docs/latest/reference/operator.html#view) directives, which allow us to inspect the contents of a channel.
525+
We could run this right away to test if it works, but while we're at it, we're also going to add a couple of [`view()`](https://www.nextflow.io/docs/latest/reference/operator.html#view) operators, which allow us to inspect the contents of a channel.
526526
You can think of `view()` as a debugging tool, like a `print()` statement in Python, or its equivalent in other languages.
527527

528528
In the workflow block, make the following code change:
@@ -540,12 +540,25 @@ _After:_
540540
```groovy title="hello-channels.nf" linenums="31"
541541
// create a channel for inputs
542542
greeting_ch = Channel.of(greetings_array)
543-
.view { "Before flatten: $it" }
543+
.view { greeting -> "Before flatten: $greeting" }
544544
.flatten()
545-
.view { "After flatten: $it" }
545+
.view { greeting -> "After flatten: $greeting" }
546546
```
547547

548-
Here `$it` is an implicit variable that represents each individual item loaded in a channel.
548+
We are using an operator _closure_ here - the curly brackets.
549+
This code executes for each item in the channel.
550+
We define a temporary variable for the inner value, here called `greeting` (it could be anything).
551+
This variable is only used within the scope of that closure.
552+
553+
In this example, `$greeting` represents each individual item loaded in a channel.
554+
555+
!!! note "Note on `$it`"
556+
557+
In some pipelines you may see a special variable called `$it` used inside operator closures.
558+
This is an _implicit_ variable that allows a short-hand access to the inner variable,
559+
without needing to define it with a `->`.
560+
561+
We prefer to be explicit to aid code clarity, as such the `$it` syntax is discouraged and will slowly be phased out of the Nextflow language.
549562

550563
#### 3.2.3. Run the workflow
551564

@@ -723,9 +736,9 @@ _After:_
723736
```groovy title="hello-channels.nf" linenums="31"
724737
// create a channel for inputs from a CSV file
725738
greeting_ch = Channel.fromPath(params.greeting)
726-
.view { "Before splitCsv: $it" }
739+
.view { csv -> "Before splitCsv: $csv" }
727740
.splitCsv()
728-
.view { "After splitCsv: $it" }
741+
.view { csv -> "After splitCsv: $csv" }
729742
```
730743

731744
As you can see, we also include before/after view statements while we're at it.
@@ -787,7 +800,7 @@ This is what the syntax looks like:
787800

788801
This means 'for each element in the channel, take the first of any items it contains'.
789802

790-
So let's apply that to our CVS parsing.
803+
So let's apply that to our CSV parsing.
791804

792805
#### 4.3.1. Apply `map()` to the channel
793806

@@ -798,21 +811,21 @@ _Before:_
798811
```groovy title="hello-channels.nf" linenums="31"
799812
// create a channel for inputs from a CSV file
800813
greeting_ch = Channel.fromPath(params.greeting)
801-
.view { "Before splitCsv: $it" }
814+
.view { csv -> "Before splitCsv: $csv" }
802815
.splitCsv()
803-
.view { "After splitCsv: $it" }
816+
.view { csv -> "After splitCsv: $csv" }
804817
```
805818

806819
_After:_
807820

808821
```groovy title="hello-channels.nf" linenums="31"
809822
// create a channel for inputs from a CSV file
810823
greeting_ch = Channel.fromPath(params.greeting)
811-
.view { "Before splitCsv: $it" }
824+
.view { csv -> "Before splitCsv: $csv" }
812825
.splitCsv()
813-
.view { "After splitCsv: $it" }
826+
.view { csv -> "After splitCsv: $csv" }
814827
.map { item -> item[0] }
815-
.view { "After map: $it" }
828+
.view { csv -> "After map: $csv" }
816829
```
817830

818831
Once again we include another `view()` call to confirm that the operator does what we expect.

docs/hello_nextflow/03_hello_workflow.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ _After:_
485485
collectGreetings(convertToUpper.out.collect())
486486
487487
// optional view statements
488-
convertToUpper.out.view { "Before collect: $it" }
489-
convertToUpper.out.collect().view { "After collect: $it" }
488+
convertToUpper.out.view { greeting -> "Before collect: $greeting" }
489+
convertToUpper.out.collect().view { greeting -> "After collect: $greeting" }
490490
}
491491
```
492492

@@ -816,11 +816,9 @@ _After:_
816816
collectGreetings(convertToUpper.out.collect(), params.batch)
817817
818818
// emit a message about the size of the batch
819-
collectGreetings.out.count.view { "There were $it greetings in this batch" }
819+
collectGreetings.out.count.view { num_greetings -> "There were $num_greetings greetings in this batch" }
820820
```
821821

822-
Here we are using `$it` in the same way we did earlier, as an implicit variable to access the contents of the channel.
823-
824822
!!! note
825823

826824
There are a few other ways we could achieve a similar result, including some more elegant ones like the `count()` operator, but this allows us to show how to handle multiple outputs, which is what we care about.

docs/hello_nextflow/05_hello_containers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ You can see that the filesystem inside the container is different from the files
189189
When you run a container, it is isolated from the host system by default.
190190
This means that the container can't access any files on the host system unless you explicitly allow it to do so.
191191

192-
You will learn how to do that in a minute.
192+
You will learn how to do that in a minute.
193193

194194
#### 1.3.2. Run the desired tool command(s)
195195

@@ -434,7 +434,7 @@ _Before:_
434434
collectGreetings(convertToUpper.out.collect(), params.batch)
435435
436436
// emit a message about the size of the batch
437-
collectGreetings.out.count.view{ "There were $it greetings in this batch" }
437+
collectGreetings.out.count.view{ num_greetings -> "There were $num_greetings greetings in this batch" }
438438
```
439439

440440
_After:_
@@ -444,7 +444,7 @@ _After:_
444444
collectGreetings(convertToUpper.out.collect(), params.batch)
445445
446446
// emit a message about the size of the batch
447-
collectGreetings.out.count.view{ "There were $it greetings in this batch" }
447+
collectGreetings.out.count.view{ num_greetings -> "There were $num_greetings greetings in this batch" }
448448
449449
// generate ASCII art of the greetings with cowpy
450450
cowpy(collectGreetings.out.outfile, params.character)

docs/hello_nextflow/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The rise of big data has made it increasingly necessary to be able to analyze an
1212

1313
During this training, you will be introduced to Nextflow in a series of complementary hands-on workshops.
1414

15-
Let's get started! Click on the "Open in GitHub Codespaces" button below.
15+
Let's get started! Click on the "Open in GitHub Codespaces" button below to launch the training environment (preferably in a separate tab), then read on while it loads.
1616

1717
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/nextflow-io/training?quickstart=1&ref=master)
1818

docs/nf4_science/genomics/index.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ It builds on the [Hello Nextflow](../../hello_nextflow/) beginner training and d
1111

1212
Specifically, this course demonstrates how to implement a simple variant calling pipeline with [GATK](https://gatk.broadinstitute.org/) (Genome Analysis Toolkit), a widely used software package for analyzing high-throughput sequencing data.
1313

14-
!!! note
14+
Let's get started! Click on the "Open in GitHub Codespaces" button below to launch the training environment (preferably in a separate tab), then read on while it loads.
1515

16-
Don't worry if you're not familiar with GATK specifically.
17-
We'll summarize the necessary concepts as we go, and the workflow implementation principles we demonstrate here apply broadly to any command line tool that processes genomics data.
16+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/nextflow-io/training?quickstart=1&ref=master)
1817

1918
## Learning objectives
2019

@@ -40,9 +39,3 @@ The course assumes some minimal familiarity with the following:
4039
- Foundational Nextflow concepts and tooling covered in the [Hello Nextflow](../../hello_nextflow/) beginner training.
4140

4241
For technical requirements and environment setup, see the [Environment Setup](../../envsetup/) mini-course.
43-
44-
## Get started
45-
46-
To get started, open the training environment by clicking the 'Open in GitHub Codespaces' button below.
47-
48-
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/nextflow-io/training?quickstart=1&ref=master)

docs/nf4_science/rnaseq/00_orientation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The training environment contains all the software, code and data necessary to work through this training course, so you don't need to install anything yourself.
44
However, you do need a (free) account to log in, and you should take a few minutes to familiarize yourself with the interface.
55

6-
If you have not yet done so, please follow [this link](../../envsetup/) before going any further.
6+
If you have not yet done so, please the [Environment Setup](../../envsetup/) mini-course before going any further.
77

88
## Materials provided
99

docs/nf4_science/rnaseq/index.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,23 @@ It builds on the [Hello Nextflow](../../hello_nextflow/) beginner training and d
1111

1212
Specifically, this course demonstrates how to implement a simple bulk RNAseq processing pipeline to trim adapter sequences, align the reads to a genome reference and performs quality control (QC) at several stages.
1313

14+
Let's get started! Click on the "Open in GitHub Codespaces" button below to launch the training environment (preferably in a separate tab), then read on while it loads.
15+
16+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/nextflow-io/training?quickstart=1&ref=master)
17+
1418
## Learning objectives
1519

1620
By working through this course, you will learn how to apply foundational Nextflow concepts and tooling to a typical RNAseq use case.
1721

1822
By the end of this workshop you will be able to:
1923

2024
- Write a linear workflow to apply basic RNAseq processing and QC methods
21-
- Handle domain-specific files such as FastQ and reference genome resources appropriately
25+
- Handle domain-specific files such as FASTQ and reference genome resources appropriately
2226
- Handle single-end and paired-end sequencing data
2327
- Leverage Nextflow's dataflow paradigm to parallelize per-sample RNAseq processing
28+
- Aggregate QC reports across multiple steps and samples using relevant channel operators
29+
2430
<!-- TODO
25-
- Implement **[quality control aggregation??]** using relevant channel operators
2631
- Configure pipeline execution and manage and optimize resource allocations
2732
- Implement per-step and end-to-end pipeline tests that handle RNAseq-specific idiosyncrasies appropriately
2833
-->
@@ -37,9 +42,3 @@ The course assumes some minimal familiarity with the following:
3742
- Foundational Nextflow concepts and tooling covered in the [Hello Nextflow](../../hello_nextflow/) beginner training.
3843

3944
For technical requirements and environment setup, see the [Environment Setup](../../envsetup/) mini-course.
40-
41-
## Get started
42-
43-
To get started, open the training environment by clicking the 'Open in GitHub Codespaces' button below.
44-
45-
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/nextflow-io/training?quickstart=1&ref=master)

nf4-science/rnaseq/modules/fastqc.nf

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)