name: bedtools_bamtofastq
namespace: bedtools
description: | 
  Conversion tool for extracting FASTQ records from sequence alignments in BAM format.
keywords: [Conversion ,BAM, FASTQ]
links:
  documentation: https://bedtools.readthedocs.io/en/latest/content/tools/bamtofastq.html
  repository: https://github.com/arq5x/bedtools2
  homepage: https://bedtools.readthedocs.io/en/latest/#
  issue_tracker: https://github.com/arq5x/bedtools2/issues
references:
  doi: 10.1093/bioinformatics/btq033
license: MIT
requirements:
  commands: [bedtools]
authors:
  - __merge__: /src/_authors/theodoro_gasperin.yaml
    roles: [ author, maintainer ]

argument_groups:
  - name: Inputs
    arguments:
      - name: --input
        alternatives: -i
        type: file
        description: Input BAM file to be converted to FASTQ.
        required: true
    
  - name: Outputs
    arguments:
      - name: --fastq
        alternatives: -fq
        direction: output
        type: file
        description: Output FASTQ file.
        required: true
      
      - name: --fastq2
        alternatives: -fq2
        type: file
        direction: output
        description: |
          FASTQ for second end. Used if BAM contains paired-end data.
          BAM should be sorted by query name is creating paired FASTQ.
         
  - name: Options
    arguments:
      - name: --tags
        type: boolean_true
        description: |
          Create FASTQ based on the mate info in the BAM R2 and Q2 tags.

resources:
  - type: bash_script
    path: script.sh

test_resources:
  - type: bash_script
    path: test.sh
  - path: test_data

engines:
  - type: docker
    image: debian:stable-slim
    setup:
      - type: apt
        packages: [bedtools, procps]
      - type: docker
        run: |
          echo "bedtools: \"$(bedtools --version | sed -n 's/^bedtools //p')\"" > /var/software_versions.txt

runners:
  - type: executable
  - type: nextflow