In Nextflow I have a process that creates a channel that holds several files in a tuple. I'm trying to call only one of those files as input for a subsequent process.
So basically if I run channel_name.view()
the channel shows [/home/nextflow/work/e4/bc47bceb4569cffc01bd76e49245e9/RAxML_bestTree.tree, /home/nextflow/work/e4/bc47bceb4569cffc01bd76e49245e9/RAxML_bipartitions.tree, /home/nextflow/work/e4/bc47bceb4569cffc01bd76e49245e9/RAxML_bipartitionsBranchLabels.tree, /home/nextflow/work/e4/bc47bceb4569cffc01bd76e49245e9/RAxML_bootstrap.tree, /home/nextflow/work/e4/bc47bceb4569cffc01bd76e49245e9/RAxML_info.tree]
. I need just one file so I'm using the full name in the input
section of the process.
input:
file 'RAxML_bipartitionsBranchLabels.tree' from channel_name
That does not find the file. On the other hand, if I use .flatten()
, like this:
input:
file 'RAxML_bipartitionsBranchLabels.tree' from raxml_out_ch.flatten()
It works but reads some files before reaching to the one that matches and so the process results in error even after completing the task for this file properly and gives several outputs (for each file it looks into), some of them empty and one with the result.
[7c/2971f1] Submitted process > tree_visualisation (4)
[8d/dd129b] Submitted process > tree_visualisation (1)
[cb/0f91f5] Submitted process > tree_visualisation (5)
[6c/fb23c8] Submitted process > tree_visualisation (3)
ERROR ~ Error executing process > 'tree_visualisation (5)'
Caused by:
Process `tree_visualisation (5)` terminated with an error exit status (1)
Command executed:
Rscript tree.R RAxML_bipartitionsBranchLabels.tree phylogram.png
I'm looking for a way to filter this input so that the process only runs for this file and doesn't try with the others.
How can I do that?