From a5e3b4570e523ef48a3edb2cdc22ea59c69c2ef7 Mon Sep 17 00:00:00 2001 From: Marcel Ribeiro-Dantas Date: Tue, 29 Oct 2024 08:18:42 +0100 Subject: [PATCH 1/2] Fix tree output in orientation (Part 1) Signed-off-by: Marcel Ribeiro-Dantas --- docs/hello_nextflow/01_orientation.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/hello_nextflow/01_orientation.md b/docs/hello_nextflow/01_orientation.md index ed31bf27..45ab5ff1 100644 --- a/docs/hello_nextflow/01_orientation.md +++ b/docs/hello_nextflow/01_orientation.md @@ -48,6 +48,7 @@ If you run this inside `hello-nextflow`, you should see the following output: ├── hello-nf-test │ ├── demo-params.json │ ├── main.nf +│ ├── modules │ └── nextflow.config ├── hello-operators.nf ├── hello-world.nf From b736454d3d56b5407d39ca4bb9215116b2105e39 Mon Sep 17 00:00:00 2001 From: Marcel Ribeiro-Dantas Date: Tue, 29 Oct 2024 08:33:54 +0100 Subject: [PATCH 2/2] Replace channel constructor with channel factory That's the official way we refer to these functions on Nextflow official docs. Signed-off-by: Marcel Ribeiro-Dantas --- docs/hello_nextflow/02_hello_world.md | 10 +++++----- docs/hello_nextflow/04_hello_genomics.md | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/hello_nextflow/02_hello_world.md b/docs/hello_nextflow/02_hello_world.md index 0560f028..7bd11e8b 100644 --- a/docs/hello_nextflow/02_hello_world.md +++ b/docs/hello_nextflow/02_hello_world.md @@ -501,7 +501,7 @@ This is where channels come in: Nextflow uses channels to feed inputs to process There are multiple ways to do this, but for now, we're just going to use the simplest possible channel, containing a single value. -We're going to create the channel using the `Channel.of()` constructor, which sets up a simple value channel, and give it a hardcoded string to use as greeting by declaring `greeting_ch = Channel.of('Hello world!')`. +We're going to create the channel using the `Channel.of()` factory, which sets up a simple value channel, and give it a hardcoded string to use as greeting by declaring `greeting_ch = Channel.of('Hello world!')`. _Before:_ @@ -840,11 +840,11 @@ Learn how to make the workflow run on a batch of input values. Workflows typically run on batches of inputs that are meant to be processed in bulk, so we want to upgrade the workflow to accept multiple input values. -Conveniently, the `Channel.of()` constructor we've been using is quite happy to accept more than one value, so we don't need to modify that at all; we just have to load more values into the channel. +Conveniently, the `Channel.of()` factory we've been using is quite happy to accept more than one value, so we don't need to modify that at all; we just have to load more values into the channel. ### 8.1. Load multiple greetings into the input channel -To keep things simple, we go back to hardcoding the greetings in the constructor instead of using a parameter for the input, but we'll improve on that shortly. +To keep things simple, we go back to hardcoding the greetings in the channel factory instead of using a parameter for the input, but we'll improve on that shortly. _Before:_ @@ -1058,8 +1058,8 @@ params.input_file = "data/greetings.csv" ### 9.2. Update the channel declaration to handle the input file -At this point we introduce a new channel constructor, `Channel.fromPath()`, which has some built-in functionality for handling file paths. -We're going to use that instead of the `Channel.of()` constructor we used previously; the base syntax looks like this: +At this point we introduce a new channel factory, `Channel.fromPath()`, which has some built-in functionality for handling file paths. +We're going to use that instead of the `Channel.of()` factory we used previously; the base syntax looks like this: ```groovy title="channel construction syntax" Channel.fromPath(input_file) diff --git a/docs/hello_nextflow/04_hello_genomics.md b/docs/hello_nextflow/04_hello_genomics.md index 46e37402..61bc3054 100644 --- a/docs/hello_nextflow/04_hello_genomics.md +++ b/docs/hello_nextflow/04_hello_genomics.md @@ -234,7 +234,7 @@ workflow { } ``` -You'll notice we're using the same `.fromPath` channel constructor as we used at the end of Part 1 (Hello World) of this training series. +You'll notice we're using the same `.fromPath` channel factory as we used at the end of Part 1 (Hello World) of this training series. Indeed, we're doing something very similar. The difference is that this time we're telling Nextflow to load the file path itself into the channel as an input element, rather than reading in its contents. @@ -466,7 +466,7 @@ params.reads_bam = [ ] ``` -And that's actually all we need to do, because the channel constructor we use in the workflow body (`.fromPath`) is just as happy to accept multiple file paths to load into the input channel as it was to load a single one. +And that's actually all we need to do, because the channel factory we use in the workflow body (`.fromPath`) is just as happy to accept multiple file paths to load into the input channel as it was to load a single one. !!! note @@ -748,9 +748,9 @@ params.reads_bam = "${projectDir}/data/sample_bams.txt" This way we can continue to be lazy, but the list of files no longer lives in the workflow code itself, which is a big step in the right direction. -### 4.3. Update the channel constructor to read lines from a file +### 4.3. Update the channel factory to read lines from a file -Currently, our input channel constructor treats any files we give it as the data inputs we want to feed to the indexing process. +Currently, our input channel factory treats any files we give it as the data inputs we want to feed to the indexing process. Since we're now giving it a file that lists input file paths, we need to change its behavior to parse the file and treat the file paths it contains as the data inputs. Fortunately we can do that very simply, just by adding the [`.splitText()` operator](https://www.nextflow.io/docs/latest/reference/operator.html#operator-splittext) to the channel construction step.