-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Managed to get map() in there after all! Thanks Rob for the feedback that got me there
- Loading branch information
Showing
8 changed files
with
514 additions
and
171 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env nextflow | ||
|
||
/* | ||
* Use echo to print 'Hello World!' to a file | ||
*/ | ||
process sayHello { | ||
|
||
publishDir 'results', mode: 'copy' | ||
|
||
input: | ||
val greeting | ||
|
||
output: | ||
path 'output.txt' | ||
|
||
script: | ||
""" | ||
echo '$greeting' > output.txt | ||
""" | ||
} | ||
|
||
/* | ||
* Pipeline parameters | ||
*/ | ||
params.greeting = 'Holà mundo!' | ||
|
||
workflow { | ||
|
||
// emit a greeting | ||
sayHello(params.greeting) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env nextflow | ||
|
||
/* | ||
* Use echo to print 'Hello World!' to a file | ||
*/ | ||
process sayHello { | ||
|
||
publishDir 'results', mode: 'copy' | ||
|
||
input: | ||
val greeting | ||
|
||
output: | ||
path "${greeting}-output.txt" | ||
|
||
script: | ||
""" | ||
echo '$greeting' > '$greeting-output.txt' | ||
""" | ||
} | ||
|
||
/* | ||
* Pipeline parameters | ||
*/ | ||
params.greeting = 'greetings.csv' | ||
|
||
workflow { | ||
|
||
// create a channel for inputs from a CSV file | ||
greeting_ch = Channel.fromPath(params.greeting) | ||
.splitCsv() | ||
.map { line -> line[0] } | ||
|
||
// emit a greeting | ||
sayHello(greeting_ch) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Hello,English | ||
Bonjour,French | ||
Holà,Spanish |
34 changes: 34 additions & 0 deletions
34
hello-nextflow/solutions/2-hello-channels/hello-channels-1.nf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env nextflow | ||
|
||
/* | ||
* Use echo to print 'Hello World!' to a file | ||
*/ | ||
process sayHello { | ||
|
||
publishDir 'results', mode: 'copy' | ||
|
||
input: | ||
val greeting | ||
|
||
output: | ||
path 'output.txt' | ||
|
||
script: | ||
""" | ||
echo '$greeting' > output.txt | ||
""" | ||
} | ||
|
||
/* | ||
* Pipeline parameters | ||
*/ | ||
params.greeting = 'Holà mundo!' | ||
|
||
workflow { | ||
|
||
// create a channel for inputs | ||
greeting_ch = Channel.of('Hello Channels!') | ||
|
||
// emit a greeting | ||
sayHello(greeting_ch) | ||
} |
34 changes: 34 additions & 0 deletions
34
hello-nextflow/solutions/2-hello-channels/hello-channels-2.nf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env nextflow | ||
|
||
/* | ||
* Use echo to print 'Hello World!' to a file | ||
*/ | ||
process sayHello { | ||
|
||
publishDir 'results', mode: 'copy' | ||
|
||
input: | ||
val greeting | ||
|
||
output: | ||
path "${greeting}-output.txt" | ||
|
||
script: | ||
""" | ||
echo '$greeting' > '$greeting-output.txt' | ||
""" | ||
} | ||
|
||
/* | ||
* Pipeline parameters | ||
*/ | ||
params.greeting = 'Holà mundo!' | ||
|
||
workflow { | ||
|
||
// create a channel for inputs | ||
greeting_ch = Channel.of('Hello','Bonjour','Holà') | ||
|
||
// emit a greeting | ||
sayHello(greeting_ch) | ||
} |
39 changes: 39 additions & 0 deletions
39
hello-nextflow/solutions/2-hello-channels/hello-channels-3.nf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env nextflow | ||
|
||
/* | ||
* Use echo to print 'Hello World!' to a file | ||
*/ | ||
process sayHello { | ||
|
||
publishDir 'results', mode: 'copy' | ||
|
||
input: | ||
val greeting | ||
|
||
output: | ||
path "${greeting}-output.txt" | ||
|
||
script: | ||
""" | ||
echo '$greeting' > '$greeting-output.txt' | ||
""" | ||
} | ||
|
||
/* | ||
* Pipeline parameters | ||
*/ | ||
params.greeting = 'Holà mundo' | ||
|
||
workflow { | ||
|
||
greetings_array = ['Hello','Bonjour','Holà'] | ||
|
||
// create a channel for inputs | ||
greeting_ch = Channel.of(greetings_array) | ||
.view { "Before flatten: $it" } | ||
.flatten() | ||
.view { "After flatten: $it" } | ||
|
||
// emit a greeting | ||
sayHello(greeting_ch) | ||
} |
41 changes: 41 additions & 0 deletions
41
hello-nextflow/solutions/2-hello-channels/hello-channels-4.nf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env nextflow | ||
|
||
/* | ||
* Use echo to print 'Hello World!' to a file | ||
*/ | ||
process sayHello { | ||
|
||
publishDir 'results', mode: 'copy' | ||
|
||
input: | ||
val greeting | ||
|
||
output: | ||
path "${greeting}-output.txt" | ||
|
||
script: | ||
""" | ||
echo '$greeting' > '$greeting-output.txt' | ||
""" | ||
} | ||
|
||
/* | ||
* Pipeline parameters | ||
*/ | ||
params.greeting = 'greetings.csv' | ||
|
||
workflow { | ||
|
||
greetings_array = ['Hello','Bonjour','Holà'] | ||
|
||
// create a channel for inputs from a CSV file | ||
greeting_ch = Channel.fromPath(params.greeting) | ||
.view { "Before splitCsv: $it" } | ||
.splitCsv() | ||
.view { "After splitCsv: $it" } | ||
.map { line -> line[0] } | ||
.view { "After map: $it" } | ||
|
||
// emit a greeting | ||
sayHello(greeting_ch) | ||
} |