cwlVersion: v1.2

class: CommandLineTool

requirements:
  - class: ResourceRequirement
    coresMin: 2
    ramMin: 4000
#    tmpdirMin: 4096

label: BBMap 36.84
doc: |
  Read mapping using BBMap

baseCommand: [/unlock/infrastructure/binaries/BBMap_v38.86/bbmap.sh]

arguments:
  - "-Xmx$(inputs.memory)M"
  - "threads=$(inputs.threads)"
  - "nodisk=t"
  - "out=$(inputs.identifier).sam"
  - "statsfile=$(inputs.identifier).stats"
  - "covstats=$(inputs.identifier).covstats"
  - "rpkm=$(inputs.identifier).rpkm"

inputs:
  identifier:
    type: string
    doc: Identifier for this dataset used in this workflow
    label: identifier used
  forward_reads:
    type: File
    inputBinding:
      position: 1
      prefix: 'in='
      separate: false
  reverse_reads:
    type: File?
    inputBinding:
      position: 2
      prefix: 'in2='
      separate: false
  reference:
    type: File
    inputBinding:
      position: 3
      prefix: 'ref='
      separate: false
  memory:
    type: int?
    doc: maximum memory usage in megabytes
    label: memory usage (mb)
    default: 4000
  threads:
    type: int?
    doc: number of threads to use for computational processes
    label: number of threads
    default: 2


outputs:
  sam:
    type: stdout
  stats:
    type: File
    outputBinding:
      glob: "$(inputs.identifier).stats"
  covstats:
    type: File
    outputBinding:
      glob: "$(inputs.identifier).covstats"
  rpkm:
    type: File
    outputBinding:
      glob: "$(inputs.identifier).rpkm"

stdout: '$(inputs.identifier).sam'
