#!/usr/bin/env cwl-runner
cwlVersion: v1.2
class: CommandLineTool

label: "Kraken2 metagenomics read classification"

doc: |
    Kraken2 metagenomics read classification

requirements:
 - class: InlineJavascriptRequirement

inputs:
  threads:
    type: int?
    default: 1
    inputBinding:
      position: 0
      prefix: --threads
  identifier:
    type: string
    doc: Identifier for this dataset used in this workflow
    label: identifier used

  database:
    # type: Directory
    type: string
    doc: database location of kraken2
    inputBinding:
      position: 4
      prefix: "--db"
    
  forward_reads:
    # format: http://edamontology.org/format_1931 # FASTQ
    type:
     - File
    inputBinding:
      position: 100

  reverse_reads:
    # format: http://edamontology.org/format_1931 # FASTQ
    type:
     - "null"
     - File
    inputBinding:
      position: 101

  paired_end:
    type:
    - "null"
    - boolean
    doc: "data paired end (separate files)"
    inputBinding:
      position: 2
      prefix: '--paired'
    default: true

  gzip:
    type:
    - "null"
    - boolean
    doc: "input data is gzip compressed"
    inputBinding:
      position: 3
      prefix: '--gzip-compressed'
    default: false

  bzip2:
    type:
    - "null"
    - boolean
    doc: "input data is gzip compressed"
    inputBinding:
      position: 3
      prefix: '--bzip2-compressed'
    default: false
  
arguments:
  - prefix: "--output"
    valueFrom: $(inputs.identifier)_kraken2.txt
  - prefix: "--report"
    valueFrom: $(inputs.identifier)_kraken2_report.txt  
  - "--report-zero-counts"
  - "--use-names"
  

baseCommand: [/unlock/infrastructure/binaries/kraken2-2.0.9-beta/kraken2]

outputs:
  kraken: 
    type: File
    outputBinding:
      glob: $(inputs.identifier)_kraken2.txt
  report:
    type: File
    outputBinding:
      glob: $(inputs.identifier)_kraken2_report.txt  

s:author:
  - class: s:Person
    s:identifier: https://orcid.org/0000-0001-8172-8981
    s:email: mailto:jasper.koehorst@wur.nl
    s:name: Jasper Koehorst
  - class: s:Person
    s:identifier: https://orcid.org/0000-0001-9524-5964
    s:email: mailto:bart.nijsse@wur.nl
    s:name: Bart Nijsse

s:citation: https://m-unlock.nl
s:codeRepository: https://gitlab.com/m-unlock/cwl
s:dateCreated: "2020-00-00"
s:license: https://spdx.org/licenses/Apache-2.0 
s:copyrightHolder: "UNLOCK - Unlocking Microbial Potential"

$namespaces:
  s: https://schema.org/
  edam: http://edamontology.org/

$schemas:
 - http://edamontology.org/EDAM_1.18.owl
