Skip to content

Commit c3f0d85

Browse files
authored
Assorted fixes for issues reported by external folks (#690)
* add missing closing brace to fix issue #673 * fix issue #676 * Address #677
1 parent 7a7b8e4 commit c3f0d85

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

docs/side_quests/debugging.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ Let's examine `badpractice_syntax.nf` to see what the VSCode extension is warnin
646646
```groovy title="badpractice_syntax.nf" hl_lines="3" linenums="1"
647647
#!/usr/bin/env nextflow
648648
649-
input_ch = channel.of('sample1', 'sample2', 'sample3') # WARNING: Channel defined outside workflow
649+
input_ch = channel.of('sample1', 'sample2', 'sample3') // WARNING: Channel defined outside workflow
650650
651651
process PROCESS_FILES {
652652
input:
@@ -703,7 +703,7 @@ Follow the VSCode extension's recommendation by moving the channel definition in
703703
}
704704

705705
workflow {
706-
input_ch = channel.of('sample1', 'sample2', 'sample3') # Moved inside workflow block
706+
input_ch = channel.of('sample1', 'sample2', 'sample3') // Moved inside workflow block
707707
PROCESS_FILES(input_ch)
708708
}
709709
```
@@ -713,7 +713,7 @@ Follow the VSCode extension's recommendation by moving the channel definition in
713713
```groovy title="badpractice_syntax.nf" hl_lines="3" linenums="1"
714714
#!/usr/bin/env nextflow
715715

716-
input_ch = channel.of('sample1', 'sample2', 'sample3') # WARNING: Channel defined outside workflow
716+
input_ch = channel.of('sample1', 'sample2', 'sample3') // WARNING: Channel defined outside workflow
717717

718718
process PROCESS_FILES {
719719
input:
@@ -959,7 +959,7 @@ There are a couple of ways to address this depending on how many files are affec
959959

960960
**Option 1**: You have a single reference file that you are re-using a lot. You can simply create a value channel type, which can be used over and over again. There are three ways to do this:
961961

962-
**1.** Use `channel.value()`:
962+
**1a** Use `channel.value()`:
963963

964964
```groovy title="exhausted.nf (fixed - Option 1a)" hl_lines="2" linenums="21"
965965
workflow {
@@ -970,7 +970,7 @@ workflow {
970970
}
971971
```
972972

973-
**2.** Use the `first()` [operator](https://www.nextflow.io/docs/latest/reference/operator.html#first):
973+
**1b** Use the `first()` [operator](https://www.nextflow.io/docs/latest/reference/operator.html#first):
974974

975975
```groovy title="exhausted.nf (fixed - Option 1b)" hl_lines="2" linenums="21"
976976
workflow {
@@ -981,7 +981,7 @@ workflow {
981981
}
982982
```
983983

984-
**3.** Use the `collect()` [operator](https://www.nextflow.io/docs/latest/reference/operator.html#collect):
984+
**1c.** Use the `collect()` [operator](https://www.nextflow.io/docs/latest/reference/operator.html#collect):
985985

986986
```groovy title="exhausted.nf (fixed - Option 1c)" hl_lines="2" linenums="21"
987987
workflow {
@@ -996,17 +996,27 @@ workflow {
996996

997997
```groovy title="exhausted.nf (fixed - Option 2)" hl_lines="4" linenums="21"
998998
workflow {
999-
reference_ch = channel.of('baseline_reference')
999+
reference_ch = channel.of('baseline_reference','other_reference')
10001000
input_ch = channel.of('sample1', 'sample2', 'sample3')
10011001
combined_ch = reference_ch.combine(input_ch) // Creates cartesian product
10021002
10031003
PROCESS_FILES(combined_ch)
10041004
}
10051005
```
10061006

1007-
`.combine()` generates a cartesian product of the two channels, so each item in `reference_ch` will be paired with each item in `input_ch`. This allows the process to run for each sample while still using the reference.
1007+
The `.combine()` operator generates a cartesian product of the two channels, so each item in `reference_ch` will be paired with each item in `input_ch`. This allows the process to run for each sample while still using the reference.
1008+
1009+
This requires the process input to be adjusted. In our example, the start of the process definition would need to be adjusted as follows:
1010+
1011+
```groovy title="exhausted.nf (fixed - Option 2)" hl_lines="5" linenums="1"
1012+
#!/usr/bin/env nextflow
1013+
1014+
process PROCESS_FILES {
1015+
input:
1016+
tuple val(reference), val(sample_name)
1017+
```
10081018

1009-
> Note: This requires the process input to be adjusted and therefore is not suitable in all situations.
1019+
This approach may not be suitable in all situations.
10101020

10111021
#### Run the pipeline
10121022

docs/side_quests/metadata.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ Then, at the workflow level, we extract the `character` property from the metada
727727
=== "After"
728728

729729
```groovy title="main.nf" linenums="61" hl_lines="1"
730-
COWPY(ch_languages.map{meta, file -> [meta, meta.character, file] )
730+
COWPY(ch_languages.map{meta, file -> [meta, meta.character, file]})
731731
```
732732

733733
=== "Before"

0 commit comments

Comments
 (0)