diff --git a/docs/hello_nextflow/02_hello_world.md b/docs/hello_nextflow/02_hello_world.md index 7426c07a..f6f7f87b 100644 --- a/docs/hello_nextflow/02_hello_world.md +++ b/docs/hello_nextflow/02_hello_world.md @@ -1100,35 +1100,41 @@ greeting_ch = Channel.fromPath(params.input_file) .flatten() ``` -If you want to see the impact of `.flatten()`, we can make use of `.view()`, another operator, to demonstrate. Edit that section of code so it looks like: +If you want to see the impact of `.flatten()`, we can make use of `.dump()`, another operator, to demonstrate. Edit that section of code so it looks like: ```groovy title="flatten usage" // create a channel for inputs from a CSV file greeting_ch = Channel.fromPath(params.input_file) .splitCsv() - .view{ "After splitCsv: $it" } + .dump(tag: "After splitCsv" ) .flatten() - .view{ "After flatten: $it" } + .dump(tag: "After flatten" ) +``` + +and add `-dump-channels` to your run command: + +```bash +nextflow run hello-world.nf -dump-channels ``` When you run this updated workflow, you'll see the difference: ```console title="view output with and without flatten" -After splitCsv: [Hello, Bonjour, Holà] -After flatten: Hello -After flatten: Bonjour -After flatten: Holà [d3/1a6e23] Submitted process > sayHello (3) [8f/d9e431] Submitted process > sayHello (1) [e7/a088af] Submitted process > sayHello (2) [1a/776e2e] Submitted process > convertToUpper (1) [83/fb8eba] Submitted process > convertToUpper (2) [ee/280f93] Submitted process > convertToUpper (3) +[DUMP: After splitCsv] ['Hello', 'Bonjour', 'Holà'] +[DUMP: After flatten] 'Hello' +[DUMP: After flatten] 'Bonjour' +[DUMP: After flatten] 'Holà' ``` As you can see, the flatten() operator has transformed the channel from containing arrays to containing individual elements. This can be useful when you want to process each item separately in your workflow. -Remove the `.view()` operations before you continue. +Remove the `.dump()` operations before you continue. ### 9.3. Run the workflow (one last time!) @@ -1152,17 +1158,17 @@ Looking at the outputs, we see each greeting was correctly extracted and process !!! tip - While you're developing your pipeline, you can inspect the contents of any channel by adding the `.view()` operator to the name of the channel. - For example, if you add `greeting_ch.view()` anywhere in the workflow body, when you run the script, Nextflow will print the channel contents to standard out. + While you're developing your pipeline, you can inspect the contents of any channel by adding the `.dump()` operator to the name of the channel and add `-dump-channels` to the run command. + For example, if you add `greeting_ch.dump()` anywhere in the workflow body, when you run the script, Nextflow will print the channel contents to standard out. You can also use this to inspect the effect of the operators. - For example, the output of `Channel.fromPath(params.input_file).splitCsv().view()` will look like this: + For example, the output of `Channel.fromPath(params.input_file).splitCsv().dump()` will look like this: ```console title="Output" [Hello, Bonjour, Holà] ``` - While the output of `Channel.fromPath(params.input_file).splitCsv().flatten().view()` will look like this: + While the output of `Channel.fromPath(params.input_file).splitCsv().flatten().dump()` will look like this: ```console title="Output" Hello diff --git a/docs/hello_nextflow/05_hello_operators.md b/docs/hello_nextflow/05_hello_operators.md index 185b465f..045ec22d 100644 --- a/docs/hello_nextflow/05_hello_operators.md +++ b/docs/hello_nextflow/05_hello_operators.md @@ -467,7 +467,7 @@ Does that seem a bit complicated? Let's break this down and translate it into pl !!!tip - If you're having a hard time envisioning exactly what is happening here, remember that you can use the `view()` operator to inspect the contents of channels before and after applying channel operators. + If you're having a hard time envisioning exactly what is happening here, remember that you can use the `dump()` operator to inspect the contents of channels before and after applying channel operators. The resulting `all_gvcfs_ch` and `all_idxs_ch` channels are what we're going to plug into the `GATK_GENOMICSDB` process we just wrote.