This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is there a way to set a basename for an output Directory?

For example:

  clipping_dir:
    type: Directory
    outputBinding:
      glob: '*/'
      outputEval: |
        ${
          self.basename = inputs.fastq1.basename.replace('_R1_*', '');
          return self
        }

This results in the following output directory:

"clipping_dir": {
    "basename": "",
    "nameext": "",
    "nameroot": "",
    "location": "file:///home/johnsoni/TEST_RUNS_7/3463813341082909bfada3015f8e63ce/3463813341082909bfada3015f8e63ce",
    "class": "Directory"
},
cwl

Hello chrisball053 and welcome to biostars,

please note that Answers should ONLY be used to respond to the original question at the top of this page and provide (full) solutions.

Use the ADD COMMENT or ADD REPLY buttons above to respond to someone, ask for clarifications, request more details etc.

So I moved your post to a comment.

Keep on writing!

fin swimmer

1 answer

I got this to work with the following example:

  clipping_dir:
    type: Directory
    outputBinding:
      glob: '*/'
      outputEval: |
        ${
          self[0].basename = inputs.fastq1.basename.split('_R1_')[0] + '_umi_clipping_results';
          return self[0]
        }

I assume that */ becomes an array, and that the first element must be accessed with [0]

However, I'm not sure if this follows the best practices for doing this in CWL

Log in to answer this question.