cgat-developers / ruffus

CGAT-ruffus is a lightweight python module for running computational pipelines
MIT License
173 stars 34 forks source link

From one task with multiple output to many tasks with single output #77

Open felixeye opened 8 years ago

felixeye commented 8 years ago

Hi, I am having a little issue figuring out how to solve the following problem. Hope to get some helpful ideas from you guys. Please let me know if this is not the right place to ask this question.

The problem is the following: I have a task (let's call it task4) that outputs 3 files, let's say file_A.txt, file_B.txt, file_C.txt. I would like the next task to process all these files one by one (one task per file).

Small Example to make it clear,

...
@transform(task4, 
    regex(r"(.+)\.txt$"), 
    [
        r"\1.5", #file_A.5
        r"\1.5", #file_B.5
        r"\1.5", #file_C.5
    ]
)
def task5(in_files, out_files):
    """out_files contains [file_A.X, file_B.X,file_C.X]"""
    pass

@transform(task5, suffix(".X"), ".Y")
def task6(in_files, out_files):
   """
    this task will be called once with
    in_files => [file_A.X, file_B.X,file_C.X]
    and I would like to have 3 calls with
    task6 file_A.X => file_A.Y
    task6 file_B.X => file_B.Y
    task6 file_C.X => file_C.Y
   """
   pass
...

I am using ruffus 2.6.3. Thank you for your help.