name: bases2fastq
description: |
  Bases2Fastq demultiplexes sequencing data generated by Element Biosciences instruments and converts base calls into FASTQ files.
keywords: ["demultiplex", "fastq", "demux", "Element Biosciences"]
links:
  homepage: https://www.elembio.com/
  documentation: https://docs.elembio.io/docs/bases2fastq/introduction/
  repository: https://github.com/Illumina/bases2fastq
license: Proprietary
requirements:
  commands: [bases2fastq]
authors:
  - __merge__: /src/_authors/dries_schaumont.yaml
    roles: [ author, maintainer ]

argument_groups:
  - name: Input
    arguments:
      - name: "--analysis_directory"
        type: file
        description: Location of analysis directory
        required: true
        example: "input/"
      - name: --run_manifest
        alternatives: [-r]
        type: file
        description: Location of run manifest to use instead of default RunManifest.csv found in analysis directory
        required: false

  - name: Output
    arguments:
      - name: "--output_directory"
        alternatives: ["-o"]
        type: file
        direction: output
        required: true
        description: Location to save output fastqs
        example: fastq_dir
      - name: "--report"
        type: file
        required: false
        direction: output
        description: Output location for the HTML report
      - name: "--logs"
        type: file
        direction: output
        required: false
        description: Directory containing log files
        example: logs_dir
  - name: Arguments
    arguments:
      - name: --chemistry_version
        type: string
        required: false
        description: Run parameters override, chemistry version.
      - name: "--demux_only"
        alternatives: [-d]
        type: boolean_true
        description: |
          Generate demux files and indexing stats without generating FASTQ
      - name: "--detect_adapters"
        type: boolean_true
        description: |
          Detect adapters sequences, overriding any sequences present in run manifest.
      - name: "--error_on_missing"
        type: boolean_true
        description: |
          Terminate execution for a missing file (by default, missing files are
          skipped and execution continues). Also set by --strict.
      - name: "--exclude_tile"
        alternatives: [-e]
        multiple: true
        type: string
        description: |
          Regex matching tile names to exclude. This flag can be specified multiple times. (e.g. L1.*C0[23]S.)
      - name: "--filter_mask"
        type: string
        description: |
          Run parameters override, custom pass filter mask.
      - name: "--flowcell_id"
        type: string
        description: |
          Run parameters override, flowcell ID.
      - name: "--force_index_orientation"
        type: boolean_true
        description: |
          Do not attempt to find orientation for I1/I2 reads (reverse complement).
          Use orientation given in run manifest.
      - name: "--group_fastq"
        type: boolean_true
        description: |
           Group all FASTQ/stats/metrics for a project are in the project folder.
      - name: "--i1_cycles"
        type: integer
        min: 1
        description: |
          Run parameters override, I1 cycles.
      - name: "--i2_cycles"
        type: integer
        min: 1
        description: |
          Run parameters override, I2 cycles
      - name: "--include_tile"
        alternatives: [-i]
        type: string
        multiple: true
        description: |
          Regex matching tile names to include. This flag
          can be specified multiple times. (e.g. L1.*C0[23]S.)
      - name: "--kit_configuration"
        type: string
        description: |
          Run parameters override, kit configuration.
      - name: "--legacy_fastq"
        type: boolean_true
        description: |
          Legacy naming for FASTQ files (e.g. SampleName_S1_L001_R1_001.fastq.gz)
      - name: "--log_level"
        type: string
        alternatives: [-l]
        choices: ["DEBUG", "INFO", "WARNING", "ERROR"]
        description: |
          Severity level for logging.
        example: INFO
      - name: "--no_error_on_invalid"
        type: boolean_true
        description: |
          Skip invalid files and continue execution. Overridden by --strict options
      - name:  "--no_projects"
        type: boolean_true
        description: |
          Disable project directories
      - name: "--num_unassigned"
        type: integer
        min: 0
        max: 1000
        example: 30
        description: |
          Max Number of unassigned sequences to report.
      - name: "--preparation_workflow"
        type: string
        description: |
          Run parameters override, preparation workflow. 
      - name: --qc_only
        type: boolean_true
        description: |
          Quickly generate run stats for single tile without generating FASTQ.
          Use --include_tile/--exclude_tile to define custom tile set.
      - name: --r1_cycles
        type: integer
        min: 1
        description: |
          Run parameters override, R1 cycles.
      - name: --r2_cycles
        type: integer
        min: 1
        description: |
          Run parameters override, R2 cycles.
      - name: "--split_lanes"
        type: boolean_true
        description: |
          Split FASTQ files by lane.
      - name: "--skip_qc_report"
        type: boolean_true
        description: |
          Do not generate HTML QC report.
      - name: "--skip_multi_qc"
        type: boolean_true
        description: |
          Do not generate MultiQC HTML report.
      - name: "--settings"
        type: string
        multiple: true
        description: |
          Run manifest settings override. This option may be specified multiple times.
  
  # Cyto-fastq specific arguments
  - name: "Cyto-fastq Arguments"
    arguments:
      - name: "--batch"
        type: string
        description: |
          Restrict cyto-fastq generation to batch(es) that match comma delimited list (e.g. --batch B01,B02,B03).
      - name: "--cyto_fastq_mask"
        type: string
        multiple: true
        description: |
          Cycle mask for cyto fastq generation. This flag can be specified multiple times.
      - name: "--panel"
        type: file
        description: |
          Local or remote path to panel JSON
      - name: "--per_target_fastq"
        type: boolean_true
        description: |
          Create per-target fastq for each cell assignment target site in each DISS batch according to FastqMasks in TargetCellAssignmentManifest.
      - name: "--tca_manifest"
        type: file
        description: |
          Location of TargetCellAssignmentManifest to use instead of default csv found in analysis directory
  
        # Arguments not included as per contributing guidelines:
        # --help, -h                      Display this usage statement (handled by viash)              
        # --input-remote, NAME            Rclone remote name for remote ANALYSIS_DIRECTORY (not needed for biobox)
        # --num-threads, -p NUMBER        Number of threads (use meta_cpus instead)
        # --output-remote, NAME           Rclone remote name for remote OUTPUT_DIRECTORY (not needed for biobox)
        # --version, -v                   Display bases2fastq version (handled by viash)

resources:
  - type: bash_script
    path: script.sh

test_resources:
  - type: bash_script
    path: test.sh
  - type: file
    path: /src/_utils/test_helpers.sh

engines:
- type: docker
  image: elembio/bases2fastq:2.2.1
  setup:
    - type: docker
      run: |
        bases2fastq --version 2>&1 | head -1 | sed 's/.*version \([0-9\\.]*\).*/bases2fastq: \1/' > /var/software_versions.txt

runners:
  - type: executable
  - type: nextflow
