PMCC-BioinformaticsCore / janis-core

Core python modules for Janis Pipeline workflow assistant
GNU General Public License v3.0
4 stars 9 forks source link

Janis is not creating secondary output in WDL for array of outputs in tool #62

Open illusional opened 3 years ago

illusional commented 3 years ago

Consider the tool with some GenericFile with secondaries [".csv"] (eg: base.txt w/ sec: base.txt.csv:

import janis_core as j

dt = j.GenericFileWithSecondaries(secondaries=[".csv"])
ToolWithSecondaryFiles = j.CommandToolBuilder(
    tool="secondary_files",
    version="v0.1.0",
    container="ubuntu:latest",
    base_command="echo",
    inputs=[
        j.ToolInput("inp", dt, position=0)
    ],
    outputs=[
        j.ToolOutput("out", j.Array(dt), selector=j.WildcardSelector("*.txt"))
    ],
)

This gives the approx WDL translation:

task secondary_files {
  input {
    File inp
    File inp_csv
  }
  command <<<
    set -e
    echo ~{inp}
  >>>
  output {
    Array[File] out = glob("*.txt")
    # Expect to see 
    # Array[File] out_csv = ...
  }
}

It's missing the output:

Array[File] out_csv = ...

This is probably pretty tricky without a map function in WDL. It might not even be strictly possible. Just thought it be better documented that this is an issue.