Skip to content

Commit

Permalink
Update 03-processes.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrimes authored Feb 26, 2021
1 parent c855b3a commit aa64bc1
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions _episodes/03-processes.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,19 @@ process foo {
Exercise
Write a script that creates a channel containing all read files matching the pattern data/ggal/*_1.fq followed by a process that concatenates them into a single file and prints the first 20 lines.

~~~
reads = Channel.fromPath( 'data/ggal/*_1.fq' )
process foo {
input:
file sample from reads.collect()
script:
"""
head -n 20 $sample > combined_n20.txt
"""
}
~~
### Combine input channels
A key feature of processes is the ability to handle inputs from multiple channels. However it’s important to understands how the content of channel and their semantic affect the execution of a process.
Expand Down Expand Up @@ -422,8 +435,20 @@ process bar {
}
~~~
Exercise
## Exercise Combine input channels
Write a process that is executed for each read file matching the pattern data/ggal/*_1.fq and use the same data/ggal/transcriptome.fa in each execution.
~~~
process combine {
echo true
input:
path(y) from Channel.fromPath('data/ggal/*_1.fq')
path(x) from Channel.value('ggal/transcriptome.fa')
script:
"""
echo $x and $y
"""
}
~~~
{: .source}
Expand All @@ -449,8 +474,23 @@ process alignSequences {
In the above example every time a file of sequences is received as input by the process, it executes three tasks running an alignment with a different value for the `mode` option. This is useful when you need to repeat the same task for a given set of parameters.
Exercise
Extend the previous example so a task is executed for each read file matching the pattern data/ggal/*_1.fq and repeat the same task both with salmon and kallisto.
>> ##Exercise
>> Extend the previous example so a task is executed for each read file matching the pattern data/ggal/*_1.fq and repeat the same task both with salmon and kallisto.
>> ~~~
>> sequences = Channel.fromPath('data/raw_reads/SRR4204500/*.fastq.gz')
>> kmers = [21, 19, 31]
>>
>> process alignSequences {
>> input:
>> path seq from sequences
>> each kmer from kmers
>>
>> """
>> echo $kmer $seq
>> """
>> }
>> ~~~
methods = ['regular', 'expresso', 'psicoffee']
## Outputs
Expand Down

0 comments on commit aa64bc1

Please sign in to comment.