#!/usr/bin/env cwl-runner

cwlVersion: v1.2
class: CommandLineTool

label: "MetaBat2"

doc: |
    Metagenome Binning based on Abundance and Tetranucleotide frequency (MetaBat2)

requirements:
 - class: InlineJavascriptRequirement

inputs:

  identifier:
    type: string
    doc: Identifier for this dataset used in this workflow
    label: identifier used

  threads:
    type: int?
    label: Number of threads to use
    default: 1
    inputBinding:
      position: 0
      prefix: --numThreads

  assembly:
    type: File
    label: The input assembly in fasta format
    inputBinding:
      position: 4
      prefix: -i

  depths:
    type: File
    inputBinding:
      position: 5
      prefix: -a

arguments:
  - prefix: "--outFile"
    valueFrom: $(inputs.identifier)_MetaBat2_bins/$(inputs.identifier)_bin
    
baseCommand: [/unlock/infrastructure/binaries/metabat_2.12.1/metabat2]

stdout: $(inputs.identifier)_MetaBat2.log

outputs:
  bin_dir:
    type: Directory
    outputBinding:
      glob: $(inputs.identifier)_MetaBat2_bins
  bins:
    type: File[]
    outputBinding:
      glob: $(inputs.identifier)_MetaBat2_bins/$(inputs.identifier)_bin*
  log:
    type: File
    outputBinding:
        glob: $(inputs.identifier)_MetaBat2.log
