This is a test version of Biostars. For the public version, visit https://www.biostars.org.
CWL bwa create index to bwa mem alignment workflow

Hi,

My question is about whether there exists any examples of how to create a workflow in CWL consisting of two steps:

  1. Create BWA indexes from input FASTA using BWA INDEX
  2. Pass indexes from step 1 to BWA MEM to perform an alignment

The issue I foresee is that BWA MEM in Step 2 expects a single reference FASTA as the command line input, and yet Step 1 creates a number of files which must be placed in the correct directory such that BWA MEM can access them. So, how does one cleanly pass the output of Step 1 into Step 2?

Thanks

common-workflow-language cwl

1 answer

There are examples available at official repository (https://github.com/common-workflow-language/workflows).

I also have publicly available CWL files for BWA made by myself here: https://github.com/labbcb/tool-bwa. I didd't find any example of workflow that uses these CWL files. Here an example using my CWL files (from a workflow I am working):

cwlVersion: v1.0
class: Workflow

requirements:
  ScatterFeatureRequirement: {}
  StepInputExpressionRequirement: {}
  InlineJavascriptRequirement: {}

inputs:
  files_R1: File[]
  files_R2: File[]
  ref: File
  M: boolean
  workers: int

outputs:
  aligned-files:
    type: File[]
    outputSource: align/output-file

steps:
  index:
    run: https://raw.githubusercontent.com/labbcb/tool-bwa/master/bwa-index.cwl
    in:
      file: ref
    out: [output]
  align:
    run: https://raw.githubusercontent.com/labbcb/tool-bwa/master/bwa-mem.cwl
    scatter: [file_R1, file_R2]
    scatterMethod: dotproduct
    in:
      file_R1: files_R1
      file_R2: files_R2
      output:
        valueFrom: $(inputs.file_R1.basename).sam
      idxbase: index/output
      M: M
      t: workers
    out: [output-file]

Input data:

files_R1:
  - class: File
    path: Sample_1_R1.fastq.gz
  - class: File
    path: Sample_2_R1.fastq.gz
files_R2:
  - class: File
    path: Sample_1_R2.fastq.gz
  - class: File
    path: Sample_2_R2.fastq.gz
workers: 4
ref:
  class: File
  path: genome.fasta
M: true

Log in to answer this question.