I'm a newbie Nexflow user. And I'm struggling to familiarize input/output jacks in Nexflow. I knew that Nextflow has DAG visualisation, a useful feature for drawing a directed chart for flow.
I have a silly small chart like this.
I want to write a Nextflow file for the upper pipeline. Especially, I expect that the outputs of process A can be jacked on processes B and C in a particular way. Outputs name be shown off in the output flowchart (when run with tag -with-dag
).
If someone helps me, I'll very much appreciate it. Thanks.
Complement
This is my script. At my level, I just only can use path
as my output. This leads my script more verbose because of the paths of the file. Above all, when using the draw chart feature, the output isn't clear as I expected like the initial flowchart.
#!/usr/bin/env nextflow
params.input_text = "abc"
process A{
input:
val text
output:
path A_folder
"""
mkdir A_folder
string=$text
for element in \$(seq 0 \$((\${#string}-1)))
do
echo \${string:\$element:1} > A_folder/\$element.txt
done
"""
}
process B{
input:
path A_folder
output:
path B_folder
"""
mkdir B_folder
echo \$(cat $A_folder/0.txt)\$(cat $A_folder/1.txt) > B_folder/glue1.txt
"""
}
process C{
input:
path A_folder
output:
path C_folder
"""
mkdir C_folder
echo \$(cat $A_folder/2.txt | sed 's/c/3/g') > C_folder/tras.txt
"""
}
process D{
input:
path B_folder
path C_folder
output:
path D_folder
"""
mkdir D_folder
echo \$(cat $C_folder/tras.txt)\$(cat $B_folder/glue1.txt) > D_folder/glue2.txt
"""
}
workflow{
process_A = A(params.input_text)
process_B = B(process_A)
process_C = C(process_A)
process_D = D(process_B, process_C)
}
Summarily, my question is "After writing the code and running the script (nextflow run script.nf -with-dag flow.png
) . How to get the flowchart as similar to the first chart as possible?"