name: well_fastqs_to_esets
namespace: workflows
description: |
    Map a list of FASTQ files (one for each well) to a reference genome and generate count matrices.
    Sometimes counts from different FASTQ files need to be concatenated. This is done bases on the sample_id:
    if the sample ID of the two plates are identical, the FASTQ files will we joined _before_ mapping.
scope: "private"
authors:
  - __merge__: /src/base/authors/dries_schaumont.yaml
    roles: [ maintainer ]
argument_groups:
  - name: Input arguments
    arguments:
      - name: --input_r1
        description: |
          Forward reads in FASTQ format.
        type: file
        required: true
        multiple: true
      - name: --input_r2
        description: |
          Reverse reads in FASTQ format.
        type: file
        required: true
        multiple: true
      - name: --barcodesFasta
        type: file
        required: true
      - name: "--umi_length"
        description: |
          Length of the UMI sequences
        type: integer
        min: 1
        default: 10
      - name: --genomeDir
        type: file
        required: true
      - name: --annotation
        type: file
        required: true
      - name: --sample_id
        type: string
        required: false
        description: |
          Sample ID for the provided input files. If not provided, the value of --id
          will be used. Input files will allways be demultiplexed separately,
          but the FASTQs for wells with matching sample IDs will be concatenated before mapping.
  - name: Output arguments
    arguments:
      - name: --star_output
        description: Output from mapping with STAR
        type: file
        direction: output
        multiple: true
        required: true
        default: star.$id/*
      - name: "--nrReadsNrGenesPerChrom"
        type: file
        direction: output
        required: true
        default: "nrReadsNrGenesPerChrom.$id.txt"
      - name: "--star_qc_metrics"
        type: file
        direction: output
        required: true
        default: "starLogs.$id.txt"
      - name: "--eset"
        type: file
        direction: output
        required: true
        default: eset.$id.rds
      - name: "--f_data"
        type: file
        direction: output
        required: true
        default: fData.$id.tsv
      - name: "--p_data"
        type: file
        direction: output
        required: true
        default: pData.$id.tsv
      - name: "--html_report"
        type: file
        direction: output
        required: true
        default: report.$id.html
resources:
  - type: nextflow_script
    path: main.nf
    entrypoint: run_wf
dependencies:
  - name: stats/combine_star_logs
    repository: local
  - name: stats/generate_pool_statistics
    repository: local
  - name: stats/generate_well_statistics
    repository: local
  - name: workflows/well_demultiplex
    repository: local
  - name: workflows/well_metadata
    repository: local
  - name: parallel_map
    repository: local
  - name: eset/create_eset
    repository: local
  - name: eset/create_fdata
    repository: local
  - name: eset/create_pdata
    repository: local
  - name: report/create_report
    repository: local
  - name: utils/concatRuns
    repository: local
  - name: utils/save_params
    repository: local
repositories:
  - name: local
    type: local
  - name: bb
    type: vsh
    repo: biobox
    tag: v0.3.1

runners:
  - type: nextflow

engines:
  - type: native
