Skip to content

Commit 76f00f2

Browse files
authored
Merge branch 'master' into nftest_bits
2 parents 1068b13 + f21ffd7 commit 76f00f2

File tree

13 files changed

+151
-69
lines changed

13 files changed

+151
-69
lines changed

.github/workflows/docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Build and push the Docker image for GitPod
1+
# Build and push the Docker image for Gitpod
22
# - Only pushes if push or release
33
# - Builds without push for PRs to check the Dockerfile
44

5-
name: Build GitPod Docker image
5+
name: Build Gitpod Docker image
66

77
on:
88
pull_request:

docs/envsetup/01_setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Using a machine with more cores allows you to take greater advantage of Nextflow
2424

2525
**For our Hello Nextflow and Nextflow For Science training courses, we recommend using a 4-core machine.**
2626

27-
The free Github plan includes 120 core-hours of Codespaces compute per month, which amounts to 30 hours of a 4-core machine.
27+
The free GitHub plan includes 120 core-hours of Codespaces compute per month, which amounts to 30 hours of a 4-core machine.
2828
(See below for more information about quotas.)
2929

3030
!!! warning

docs/envsetup/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ Let's get started!
1313
For more detailed instructions for GitHub Codespaces, see the [GitHub Codespaces env-setup docs](01_setup.md).
1414
If you cannot use GitHub Codespaces and wish to use a local development environment, see the [documentation for local installation](02_local.md).
1515

16-
!!! info "Deprecation of GitPod"
16+
!!! info "Deprecation of Gitpod"
1717

1818
Nextflow Training used to use [Gitpod](https://gitpod.io) until February 2025.
1919
However, the makers of Gitpod have decided to retire the free functionality in favor of their new [Gitpod Flex](https://www.gitpod.io/blog/introducing-gitpod-flex) system.
2020
For that reason, we have switched to using GitHub Codespaces, which also offer a one-click developer environment with no prior setup.
2121

22-
Depending on when you signed up to GitPod and when exactly they retire the service, you may still be able to launch the training in their old cloud IDE, though we cannot guarantee reliable access going forward:
22+
Depending on when you signed up to Gitpod and when exactly they retire the service, you may still be able to launch the training in their old cloud IDE, though we cannot guarantee reliable access going forward:
2323
[Open in Gitpod](https://gitpod.io/#https://github.com/nextflow-io/training).

docs/hello_nextflow/00_orientation.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,35 @@
11
# Orientation
22

33
The GitHub Codespaces environment contains all the software, code and data necessary to work through this training course, so you don't need to install anything yourself.
4-
However, you do need a (free) account to log in, and you should take a few minutes to familiarize yourself with the interface.
4+
However, you do need a (free) GitHub 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 go through the [Environment Setup](../../envsetup/) mini-course before going any further.
77

8-
## Materials provided
8+
## Working directory
9+
10+
Throughout this training course, we'll be working in the `hello-nextflow/` directory.
11+
12+
Change directory now by running this command in the terminal:
13+
14+
```bash
15+
cd hello-nextflow/
16+
```
917

10-
Throughout this training course, we'll be working in the `hello-nextflow/` directory, which loads by default when you open the training workspace.
11-
This directory contains all the code files, test data and accessory files you will need.
18+
!!!tip
19+
20+
If for whatever reason you move out of this directory, you can always use the full path to return to it, assuming you're running this within the Github Codespaces training environment:
21+
22+
```bash
23+
cd /workspaces/training/hello-nextflow
24+
```
1225

13-
Feel free to explore the contents of this directory; the easiest way to do so is to use the file explorer on the left-hand side of the training workspace.
26+
Now let's have a look at the contents of this directory.
27+
28+
## Materials provided
29+
30+
You can explore the contents of this directory by using the file explorer on the left-hand side of the training workspace.
1431
Alternatively, you can use the `tree` command.
32+
1533
Throughout the course, we use the output of `tree` to represent directory structure and contents in a readable form, sometimes with minor modifications for clarity.
1634

1735
Here we generate a table of contents to the second level down:
@@ -60,12 +78,4 @@ If you run this inside `hello-nextflow`, you should see the following output:
6078
The name and number in the filename correspond to the step of the relevant part of the course.
6179
For example, the file `hello-world-4.nf` is the expected result of completing steps 1 through 4 of Part 1: Hello World.
6280

63-
!!!tip
64-
65-
If for whatever reason you move out of this directory, you can always run this command to return to it (within the training environment):
66-
67-
```bash
68-
cd /workspaces/training/hello-nextflow
69-
```
70-
71-
Now, to begin the course, click on the arrow in the bottom right corner of this page.
81+
**Now, to begin the course, click on the arrow in the bottom right corner of this page.**

docs/hello_nextflow/00_orientation.pt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Orientação
22

3-
O ambiente Github Codespaces contém todo o software, código e dados necessários para este curso. Você não precisa instalar nada por conta própria. No entanto, é necessária uma conta (gratuita) para logar - e recomendamos que você reserve alguns minutos para se familiarizar com a interface.
3+
O ambiente GitHub Codespaces contém todo o software, código e dados necessários para este curso. Você não precisa instalar nada por conta própria. No entanto, é necessária uma conta (gratuita) para logar - e recomendamos que você reserve alguns minutos para se familiarizar com a interface.
44

55
Caso ainda não tenha feito isso, siga [este link](../../envsetup/) antes de prosseguir.
66

docs/hello_nextflow/01_hello_world.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ In this first part of the Hello Nextflow training course, we ease into the topic
1212

1313
Let's demonstrate this with a simple command that we run directly in the terminal, to show what it does before we wrap it in Nextflow.
1414

15+
!!! tip
16+
17+
Remember that you should now be inside the `hello-nextflow/` directory as described in the Orientation.
18+
1519
### 0.1. Make the terminal say hello
1620

1721
```bash

docs/hello_nextflow/03_hello_workflow.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ If that worked for you, you're ready to learn how to assemble a multi-step workf
6262
We're going to add a step to convert the greeting to uppercase.
6363
To that end, we need to do three things:
6464

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.
6666
- 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.
6868

6969
### 1.1. Define the uppercasing command and test it in the terminal
7070

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:
7272

7373
```bash title="Syntax"
7474
tr '[a-z]' '[A-Z]'
@@ -338,7 +338,7 @@ Nextflow doesn't mind, so it doesn't matter.
338338
This is where things could get a little tricky, because we need to be able to handle an arbitrary number of input files.
339339
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.
340340

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`.
342342

343343
Fortunately, Nextflow is quite happy to do that for us if we simply write `cat ${input_files}` in the script command.
344344

@@ -368,7 +368,7 @@ In theory this should handle any arbitrary number of input files.
368368

369369
Some command-line tools require providing an argument (like `-input`) for each input file.
370370
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](../../nf4_science/genomics/) training course.
372372

373373
<!--[ADD LINK to note above] -->
374374

@@ -427,13 +427,13 @@ We were only expecting one, but there are three.
427427

428428
And have a look at the contents of the final output file too:
429429

430-
```console title="COLLECTED-output.txt"
430+
```console title="results/COLLECTED-output.txt"
431431
Holà
432432
```
433433

434434
Oh no. The collection step was run individually on each greeting, which is NOT what we wanted.
435435

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()`.
437437

438438
### 2.3. Use an operator to collect the greetings into a single input
439439

@@ -521,22 +521,22 @@ This time the third step was only called once!
521521
Looking at the output of the `view()` statements, we see the following:
522522

523523
- 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 single element.
525525

526526
Have a look at the contents of the final output file too:
527527

528-
```console title="COLLECTED-output.txt"
528+
```console title="results/COLLECTED-output.txt"
529529
BONJOUR
530530
HELLO
531531
HOLà
532532
```
533533

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.
535535

536536
!!! note
537537

538538
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.
540540

541541
### Takeaway
542542

@@ -742,14 +742,14 @@ Conveniently, Nextflow lets us add arbitrary code in the `script:` block of the
742742

743743
That means we can use the built-in `size()` function to get the number of files in the `input_files` array.
744744

745-
In the process block, make the following code change:
745+
In the `collectGreetings` process block, make the following code change:
746746

747747
_Before:_
748748

749749
```groovy title="hello-workflow.nf" linenums="55"
750750
script:
751751
"""
752-
cat ${input_files} > 'COLLECTED-${batch_id}-output.txt'
752+
cat ${input_files} > 'COLLECTED-${batch_name}-output.txt'
753753
"""
754754
```
755755

@@ -759,7 +759,7 @@ _After:_
759759
script:
760760
count_greetings = input_files.size()
761761
"""
762-
cat ${input_files} > 'COLLECTED-${batch_id}-output.txt'
762+
cat ${input_files} > 'COLLECTED-${batch_name}-output.txt'
763763
"""
764764
```
765765

@@ -777,14 +777,14 @@ _Before:_
777777

778778
```groovy title="hello-workflow.nf" linenums="52"
779779
output:
780-
path "COLLECTED-${batch_id}-output.txt"
780+
path "COLLECTED-${batch_name}-output.txt"
781781
```
782782

783783
_After:_
784784

785785
```groovy title="hello-workflow.nf" linenums="52"
786786
output:
787-
path "COLLECTED-${batch_id}-output.txt" , emit: outfile
787+
path "COLLECTED-${batch_name}-output.txt" , emit: outfile
788788
val count_greetings , emit: count
789789
```
790790

@@ -793,7 +793,7 @@ But as the saying goes, why not both?
793793

794794
### 4.2. Report the output at the end of the workflow
795795

796-
Now that we have two outputs coming out of the `collectGreetings` process, the `collectGreetings.out` output channel contains two 'tracks':
796+
Now that we have two outputs coming out of the `collectGreetings` process, the `collectGreetings.out` output contains two channels:
797797

798798
- `collectGreetings.out.outfile` contains the final output file
799799
- `collectGreetings.out.count` contains the count of greetings

docs/hello_nextflow/05_hello_containers.md

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The `'<container>'` part is the URI address of the container image.
8686
As an example, let's pull a container image that contains [cowpy](https://github.com/jeffbuttars/cowpy), a python implementation of a tool called `cowsay` that generates ASCII art to display arbitrary text inputs in a fun way.
8787

8888
There are various repositories where you can find published containers.
89-
We used the [Seqera Containers](https://seqera.io/containers/) service to generate this Docker container from the `cowpy` Conda package: `'community.wave.seqera.io/library/cowpy:1.1.5--3db457ae1977a273'`.
89+
We used the [Seqera Containers](https://seqera.io/containers/) service to generate this Docker container image from the `cowpy` Conda package: `'community.wave.seqera.io/library/cowpy:1.1.5--3db457ae1977a273'`.
9090

9191
Run the complete pull command:
9292

@@ -163,7 +163,7 @@ You can also run a container interactively, which gives you a shell prompt insid
163163

164164
#### 1.3.1. Spin up the container
165165

166-
To run interactively, we just add `-it` to the `docker pull` command.
166+
To run interactively, we just add `-it` to the `docker run` command.
167167
Optionally, we can specify the shell we want to use inside the container by appending _e.g._ `/bin/bash` to the command.
168168

169169
```bash
@@ -200,7 +200,7 @@ For example, the tool documentation says we can change the character ('cowacter'
200200
cowpy "Hello Containers" -c tux
201201
```
202202

203-
Now the output shows the Linux penguin, Tux, instead of the default cow, because we specified `-c tux` parameter.
203+
Now the output shows the Linux penguin, Tux, instead of the default cow, because we specified the `-c tux` parameter.
204204

205205
```console title="Output"
206206
__________________
@@ -250,7 +250,7 @@ One way to do this is to **mount** a **volume** from the host system into the co
250250
-v <outside_path>:<inside_path>
251251
```
252252

253-
In our case `<outside_path>` will be the current working directory, so we can just use a dot (`.`), and `<outside_path>` is just a name we make up; let's call it `/data`.
253+
In our case `<outside_path>` will be the current working directory, so we can just use a dot (`.`), and `<inside_path>` is just a name we make up; let's call it `/data`.
254254

255255
To mount a volume, we replace the paths and add the volume mounting argument to the docker run command as follows:
256256

@@ -266,6 +266,8 @@ You can check that it works by listing the contents of `/data`:
266266
ls /data
267267
```
268268

269+
Depending on what part of this training you've done before, the output below my look slightly different.
270+
269271
```console title="Output"
270272
demo-params.json hello-channels.nf hello-workflow.nf modules results
271273
greetings.csv hello-modules.nf hello-world.nf nextflow.config work
@@ -291,9 +293,9 @@ This produces the desired ASCII art of a turkey rattling off our example greetin
291293

292294
```console title="Output"
293295
_________
294-
/ HOLà \
295-
| HELLO |
296-
\ BONJOUR /
296+
/ Hello \
297+
| Bonjour |
298+
\ Holà /
297299
---------
298300
\ ,+*^^*+___+++_
299301
\ ,*^^^^ )
@@ -502,6 +504,21 @@ ERROR ~ Error executing process > 'cowpy'
502504

503505
Caused by:
504506
Process `cowpy` terminated with an error exit status (127)
507+
508+
Command executed:
509+
510+
cat COLLECTED-test-batch-output.txt | cowpy -c "turkey" > cowpy-COLLECTED-test-batch-output.txt
511+
512+
Command exit status:
513+
127
514+
515+
Command output:
516+
(empty)
517+
518+
Command error:
519+
.command.sh: line 2: cowpy: command not found
520+
521+
(trimmed output)
505522
```
506523

507524
This error code, `error exit status (127)` means the executable we asked for was not found.
@@ -530,7 +547,6 @@ _After:_
530547
process cowpy {
531548
532549
publishDir 'containers/results', mode: 'copy'
533-
534550
container 'community.wave.seqera.io/library/cowpy:1.1.5--3db457ae1977a273'
535551
```
536552

@@ -590,27 +606,32 @@ There were 3 greetings in this batch
590606
You can find the cowpy'ed output in the `results` directory.
591607

592608
```console title="results/cowpy-COLLECTED-test-batch-output.txt"
593-
_______
594-
/ \
609+
_________
610+
/ HOLà \
595611
| HELLO |
596-
| HOLà |
597-
| BONJOUR |
598-
\ /
599-
=======
600-
\
601-
\
602-
\
603-
\
604-
,.
605-
(_|,.
606-
,' /, )_______ _
607-
__j o``-' `.'-)'
608-
(") \'
609-
`-j |
610-
`-._( /
611-
|_\ |--^. /
612-
/_]'|_| /_)_/
613-
/_]' /_]'
612+
\ BONJOUR /
613+
---------
614+
\ ,+*^^*+___+++_
615+
\ ,*^^^^ )
616+
\ _+* ^**+_
617+
\ +^ _ _++*+_+++_, )
618+
_+^^*+_ ( ,+*^ ^ \+_ )
619+
{ ) ( ,( ,_+--+--, ^) ^\
620+
{ (\@) } f ,( ,+-^ __*_*_ ^^\_ ^\ )
621+
{:;-/ (_+*-+^^^^^+*+*<_ _++_)_ ) ) /
622+
( / ( ( ,___ ^*+_+* ) < < \
623+
U _/ ) *--< ) ^\-----++__) ) ) )
624+
( ) _(^)^^)) ) )\^^^^^))^*+/ / /
625+
( / (_))_^)) ) ) ))^^^^^))^^^)__/ +^^
626+
( ,/ (^))^)) ) ) ))^^^^^^^))^^) _)
627+
*+__+* (_))^) ) ) ))^^^^^^))^^^^^)____*^
628+
\ \_)^)_)) ))^^^^^^^^^^))^^^^)
629+
(_ ^\__^^^^^^^^^^^^))^^^^^^^)
630+
^\___ ^\__^^^^^^))^^^^^^^^)\\
631+
^^^^^\uuu/^^\uuu/^^^^\^\^\^\^\^\^\^\
632+
___) >____) >___ ^\_\_\_\_\_\_\)
633+
^^^//\\_^^//\\_^ ^(\_\_\_\)
634+
^^^ ^^ ^^^ ^
614635
```
615636

616637
You see that the character is saying all the greetings, just as it did when we ran the `cowpy` command on the `greetings.csv` file from inside the container.

docs/hello_nextflow/06_hello_config.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,4 +610,5 @@ You know how to use profiles to select a preset configuration at runtime with mi
610610
### What's next?
611611

612612
Celebrate and give yourself a big pat on the back! You have completed your very first Nextflow developer course.
613-
Then check out the training portal homepage for more training content that may be of interest.
613+
614+
Next, we ask you to complete a very short survey about your experience with this training course, then we'll take you to a page with links to further training resources and helpful links.

0 commit comments

Comments
 (0)