This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How can I indicate the output directory of one step in a workflow as an input to the next?

I am trying to use STAR for multiple steps in a workflow. The first step creates STAR indices and outputs 15 files to the working directory. The next step is the alignment and one of the arguments that it expects is the path to the directory that contains the files in the previous step. How can I indicate the output directory of the previous step as an input? Here's some of the 'steps' section:

steps:

  prepStar:
    run: lrnaStarIndex1_Star.cwl
    in:
      refGenomeFastaFile: refGenomeFasta
      spikeInFasta: spikeIn
      sjdbGtfFile: GTF_file
      #Bunch of stuff is set as defaults.
    out: [exonGeTrInfo, exonInfo, SA, SAindex, transcriptInfo, chrLength, chrNameLength, chrName, chrStart, geneInfo, Genome, genomeParameters, sjdbInfo, sjdbListFromGtfOut, sjdbListOut]

  starAlign:
    run: lrnaAlignStarPe1_STAR.cwl
    in:
      genomeDir:   #NEED HELP HERE!!! Specify the directory that contains files from prepStar step and force prepStar step to run first.
      readFilesIn: fastqExperimentFile1
      readFilesIn2: fastqExperimentFile2
      #Bunch of stuff is set as defaults.

    out: [logFinal, log, logProgress, SJout, alignedSortedByCoordOut, alignedToTranscriptomeOut]

I've played around with the In lineJavascriptRequirement and InitialWorkDirRequirement without success. Seem like referring to the prepStar step in the requirements section does not force step order and the starAlign step tries to run first.

cwl

1 answer

Hello karl.sebby,

Thank you for your question. You have at least three choices:

1) adjust the underlying tool in lrnaAlignStarPe1_STAR.cwl to not need a directory with a particular layout

2) adjust lrnaAlignStarPe1_STAR.cwl to take all the needed inputs from lrnaStarIndex1_Star.cwl (each individually named and specified) and use InitialWorkDirRequirement to place each of them into the current working directory. They you can use either . or $(runtime.outdir) (no lineJavascriptRequirement required) to communicate the location of these files to the underlying tool.

If you post your CWL files I can assist you with this option.

3) adjust lrnaStarIndex1_Star.cwl step to have an output of type: Directory, perhaps with an outputBinding: { glob: . }, then add the corresponding type: Directory input to lrnaAlignStarPe1_STAR.cwl, and finally adjust your workflow to match

Thanks. I'll give it a try.

Finally got around to working on this again and got it to work with option 3) since I didn't want to change the inputs to either tool. Can only get it to work though if outputBinding is { glob: . } as suggested.

Log in to answer this question.