Skip to content

Commit

Permalink
Merge pull request #429 from nextflow-io/minor_fixes
Browse files Browse the repository at this point in the history
✏️ typo: replace constructor with factory
  • Loading branch information
kenibrewer authored Oct 30, 2024
2 parents 8378d48 + b736454 commit 5d9048d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/hello_nextflow/01_orientation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions docs/hello_nextflow/02_hello_world.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:_

Expand Down Expand Up @@ -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:_

Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions docs/hello_nextflow/04_hello_genomics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 5d9048d

Please sign in to comment.