You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/hello_nextflow/03_hello_workflow.md
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,13 +62,13 @@ If that worked for you, you're ready to learn how to assemble a multi-step workf
62
62
We're going to add a step to convert the greeting to uppercase.
63
63
To that end, we need to do three things:
64
64
65
-
- Define the command we'lre going to use to do the uppercase conversion.
65
+
- Define the command we're going to use to do the uppercase conversion.
66
66
- Write a new process that wraps the uppercasing command.
67
-
-Add the new process to the workflow and set it up to take the output of the `sayHello()` process as input.
67
+
-Call the new process in the workflow block and set it up to take the output of the `sayHello()` process as input.
68
68
69
69
### 1.1. Define the uppercasing command and test it in the terminal
70
70
71
-
To do the conversion of the greetings to uppercase, we're going to a classic UNIX tool called `tr` for 'text replacement', with the following syntax:
71
+
To do the conversion of the greetings to uppercase, we're going to use a classic UNIX tool called `tr` for 'text replacement', with the following syntax:
72
72
73
73
```bash title="Syntax"
74
74
tr '[a-z]''[A-Z]'
@@ -338,7 +338,7 @@ Nextflow doesn't mind, so it doesn't matter.
338
338
This is where things could get a little tricky, because we need to be able to handle an arbitrary number of input files.
339
339
Specifically, we can't write the command up front, so we need to tell Nextflow how to compose it at runtime based on what inputs flow into the process.
340
340
341
-
In other words, if we have an input channel containing the item`[file1.txt, file2.txt, file3.txt]`, we need Nextflow to turn that into `cat file1.txt file2.txt file3.txt`.
341
+
In other words, if we have an input channel containing the element`[file1.txt, file2.txt, file3.txt]`, we need Nextflow to turn that into `cat file1.txt file2.txt file3.txt`.
342
342
343
343
Fortunately, Nextflow is quite happy to do that for us if we simply write `cat ${input_files}` in the script command.
344
344
@@ -368,7 +368,7 @@ In theory this should handle any arbitrary number of input files.
368
368
369
369
Some command-line tools require providing an argument (like `-input`) for each input file.
370
370
In that case, we would have to do a little bit of extra work to compose the command.
371
-
You can see an example of this in the 'Nextflow for Genomics' training course.
371
+
You can see an example of this in the [Nextflow for Genomics](https://training.nextflow.io/latest/nf4_science/genomics/) training course.
372
372
373
373
<!--[ADD LINK to note above] -->
374
374
@@ -427,13 +427,13 @@ We were only expecting one, but there are three.
427
427
428
428
And have a look at the contents of the final output file too:
429
429
430
-
```console title="COLLECTED-output.txt"
430
+
```console title="results/COLLECTED-output.txt"
431
431
Holà
432
432
```
433
433
434
434
Oh no. The collection step was run individually on each greeting, which is NOT what we wanted.
435
435
436
-
We need to do something to tell Nextflow explicitly that we want that third step to run on all the items in the channel output by `convertToUpper()`.
436
+
We need to do something to tell Nextflow explicitly that we want that third step to run on all the elements in the channel output by `convertToUpper()`.
437
437
438
438
### 2.3. Use an operator to collect the greetings into a single input
439
439
@@ -521,22 +521,22 @@ This time the third step was only called once!
521
521
Looking at the output of the `view()` statements, we see the following:
522
522
523
523
- Three `Before collect:` statements, one for each greeting: at that point the file paths are individual items in the channel.
524
-
- A single `After collect:` statement: the three file paths are now packaged into a single item.
524
+
- A single `After collect:` statement: the three file paths are now packaged into a singl element.
525
525
526
526
Have a look at the contents of the final output file too:
527
527
528
-
```console title="COLLECTED-output.txt"
528
+
```console title="results/COLLECTED-output.txt"
529
529
BONJOUR
530
530
HELLO
531
531
HOLà
532
532
```
533
533
534
-
This time we have all three greetings in the final output file. Success!
534
+
This time we have all three greetings in the final output file. Success! Remove the optional view calls to make the next outputs less verbose.
535
535
536
536
!!! note
537
537
538
538
If you run this several times without `-resume`, you will see that the order of the greetings changes from one run to the next.
539
-
This shows you that the order in which items flow through the pipeline is not guaranteed to be consistent.
539
+
This shows you that the order in which elements flow through process calls is not guaranteed to be consistent, unless you make use of fair threading (check the [fair](https://www.nextflow.io/docs/latest/reference/process.html#fair) directive).
540
540
541
541
### Takeaway
542
542
@@ -742,14 +742,14 @@ Conveniently, Nextflow lets us add arbitrary code in the `script:` block of the
742
742
743
743
That means we can use the built-in `size()` function to get the number of files in the `input_files` array.
744
744
745
-
In the process block, make the following code change:
745
+
In the `collectGreetings`process block, make the following code change:
0 commit comments