name: generate_well_statistics
namespace: "stats"
description: Generate summary statistics from BAM files generated by STAR solo.
argument_groups:
  - name: "Arguments"
    arguments:
      - name: "--input"
        type: file
        description: "The .bam file as returned by the mapping tool STAR."
        direction: input
        example: "input.bam"
      - name: "--barcode"
        type: string
        description: |
          The barcode for the well that is being processed. Is only used to add a metadata
          column to all output files.
        required: true
      - name: "--processedBAMFile"
        type: file
        description: |
          Path to a .tsv file listing, per read in the BAM file,
          the value for the "CB", "UX", "GX" and "GN" tag, together with the
          chromsome to which the read was mapped to.
        direction: output
        default: processedBamFile.txt
      - name: "--nrReadsNrGenesPerChrom"
        type: file
        description: |
          Path to an output file that contains a .tsv formatted table describing
          per chromosome the number of reads that were mapped to that chromosome (NumberOfReads
          column) and the number of genes on that chromosome that had at least one
          read mapped to it (NumberOfGenes).
        default: nrReadsNrGenesPerChrom.txt
        direction: output
      - name: "--nrReadsNrUMIsPerCB"
        type: file
        description: |
          Path to an output file that contains a .tsv formatted table describing
          per barcode the number of UMI's (nrUMIs) and the total number of reads (NumberOfReads).
        direction: output
        default: nrReadsNrUMIsPerCB.txt
      - name: "--umiFreqTop"
        type: file
        description: |
          Path to an output file that contains a .tsv formatted table describing
          per UMI (column UB) the frequency at which they occur in the reads (column
          N). Only the top 100 UMIs are included.
        default: umiFreqTop100.txt
        direction: output
      - name: "--threads"
        type: integer
        description: |
          Number of threads to use for decompressing BAM files.
        min: 1
        default: 1
resources:
- type: python_script
  path: script.py

test_resources:
  - type: python_script
    path: test.py
  - path: test.sam

engines:
  - type: docker
    image: debian:stable-slim
    setup:
      - type: docker
        env:
          - PIP_BREAK_SYSTEM_PACKAGES=1
          - HTSLIB_LIBRARY_DIR=/usr/lib/
          - HTSLIB_INCLUDE_DIR=/usr/include/
      - type: apt
        packages:
          - python3
          - python3-pip
          - python3-venv
          - python-is-python3
          - libhts-dev
          - procps
      - type: python
        packages:
          - pysam
          - pandas
    test_setup:
      - type: python
        packages:
          - viashpy
runners:
  - type: executable
  - type: nextflow