Skip to content

Commit

Permalink
Merge branch 'main' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
johnne committed Apr 28, 2022
2 parents 37b6206 + a151585 commit b898eb5
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions pages/nextflow/nextflow-5-workflow-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,26 @@ pipelines](https://nf-co.re/). Such a sample sheet for the MRSA workflow might
be stored in *e.g.* `input.csv` and look like this:

```no-highlight
sra_id
SRR935090
SRR935091
SRR935092
```

Reading input from a CSV file can be done by combining the `.fromPath()`
channel factory (specifying which file should be read) and the `.splitCsv()`
operator (splitting the rows to read each entry). Let's see if we can make it
work!
Reading input from a CSV file can be done by combining the `.splitCsv` channel
factory (splitting the rows to read each entry) and the `.map` operator
(defining which columns should be used). Let's see if we can make it work!

* Create the `input.csv` file with the above shown content.

* Change the definition of the `ch_sra_ids` channel to take the value of a new
parameter of your choice, defined in the configuration file.

* Add the `.splitCsv()` operator to the end of the channel definition, so that
the input is read from the file contents.
* Add the `.splitCsv(header: true)` operator to the end of the channel
definition, so that the input is read from the file contents.

* Add the `.map{row -> row.sra_id}` operator, which specifies that each row
should contain the `sra_id` column, but no other columns.

You should now have a more generalised input to your workflow! Try to run it to
make sure it works - look below if you need some help.
Expand All @@ -104,7 +107,10 @@ make sure it works - look below if you need some help.

```nextflow
// Channel definition
ch_sra_ids = Channel.fromPath( params.sra_ids ).splitCsv()
ch_sra_ids = Channel
.fromPath ( params.sra_ids )
.splitCsv ( header: true )
.map { row -> row.sra_id }
// Configuration file
sra_ids = "input.csv"
Expand Down

0 comments on commit b898eb5

Please sign in to comment.