I exclude the content of tar-param.cwl because it's just a trivial example of a step with one output and one input. The problem is that there will be two outputs (outA and outB) with the same file name, since they are coming from param.cwl#example_out. is there a way to rename the workflow output files?
Will you add the tar-param.cwl script anyway so that we can figure out what you are referring to as having the same name? I think if you add it we can help you better. You can rename the output files, but I'm not 100% sure that's what you need in this case without seeing the command line tool.
You will first need to do the recommendations above for your outputs from the workflow that tom.tubb suggested above.
Second, in your tar-param.cwl, you can tell the code to name the output file to match the input filename, see the example script below:
cwlVersion: v1.0
class: CommandLineTool
requirements:
- class: ShellCommandRequirement ## this may not be necessary
baseCommand: [tar]
inputs:
inFile:
type: File
outputs:
outFile:
type: File
outputBinding: {glob: $(inputs.inFile.basename).tar}
The outputBinding above is just making the output filename a variable that matches your input filename, then adding ".tar" on the end of it. I am not entirely sure if ".tar" will be added anyway because you are tarring the file. This should fix your output problem of having the same filename because it is no longer a static name.
This lets you discern between the different outputs in the context of the workflow. Now as far as i know there is no option to make any changes to a file (including its name) in a workflow. So you would have to either
generate different filenames in untarA/untarB
or
write a CommandLineTool which manipulates the name of a given input
file and add it to your workflow
In case somebody comes to this thread looking for the second solution i mentioned: Here is a CommandLineTool i use for changing file names during a workflow.
cwlVersion: v1.0
class: CommandLineTool
baseCommand: mv
label: Changes the name of a file and returns the renamed file as output
requirements:
InlineJavascriptRequirement: {}
inputs:
newname:
type: string
inputBinding:
position: 2
rename_this:
type: File
inputBinding:
position: 1
outputs:
file_renamed:
type: File
outputBinding:
glob: $(inputs.newname)
This is what i came up with using my very limited CWL-experience, so there is probably a more elegant solution.
Will you add the
tar-param.cwl
script anyway so that we can figure out what you are referring to as having the same name? I think if you add it we can help you better. You can rename the output files, but I'm not 100% sure that's what you need in this case without seeing the command line tool.I believe in your outputs, you actually need to specify:
However, I'm also not clear on how you would rename example_out so they don't conflict.