How to process a list of files, while knowing the file I"m processing?

I’m trying to process a list of csv’s but have in hand the name of the file that the row came from.

I tried this (but it didn’t work):

workflow  {
    ch_bed=Channel.from(file("${projectDir}/*.bed")){ it->Channel.fromPath(it).splitCsv(sep:"\t").collect()}.view()

I know that I can use fromPath() instead of from() but then I “lose” the name of the file, and I want it for the purposes of the pipeline.

Any pointers are very much appreciated!!

I think I solved this:

workflow  {
    .map{it->[it, it.splitCsv(sep:"\t")}

gives me enough to work from…

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.