name: "from_cellranger_multi_to_h5mu"
namespace: "convert"
scope: "public"
description: |
  Converts the output from cellranger multi to a single .h5mu file.
  By default, will map the following library type names to modality names:
    - Gene Expression: rna
    - Peaks: atac
    - Antibody Capture: prot
    - VDJ: vdj
    - VDJ-T: vdj_t
    - VDJ-B: vdj_b
    - CRISPR Guide Capture: crispr
    - Multiplexing Capture: hashing
    
  Other library types have their whitepace removed and dashes replaced by
  underscores to generate the modality name.

  Currently does not allow parsing the output from cell barcode demultiplexing.
authors:
  - __merge__: /src/authors/dries_schaumont.yaml
    roles: [ maintainer ]
arguments:
  - name: "--input"
    alternatives: ["-i"]
    type: file
    description: Input folder. Must contain the output from a cellranger multi run.
    example: input_dir_containing_modalities
    direction: input
    required: true
  - name: "--output"
    alternatives: ["-o"]
    type: file
    multiple: true
    description: |
      Locations for the output files. Must contain a wildcard (*) character,
      which will be replaced with the sample name.
    example: "*.h5mu"
    direction: output
  - name: "--sample_csv"
    type: file
    description: CSV file describing the sample name per output file
    direction: output
    example: "samples.csv"
  - name: "--uns_metrics"
    type: string
    description: Name of the .uns slot under which to QC metrics (if any).
    default: "metrics_cellranger"
__merge__: [., /src/base/h5_compression_argument.yaml]

resources:
  - type: python_script
    path: script.py
  - path: /src/utils/setup_logger.py
test_resources:
  - type: python_script
    path: test.py
  - path: /resources_test/10x_5k_anticmv
  - path: /resources_test/10x_5k_anticmv_v10
  - path: /resources_test/10x_5k_lung_crispr
  - path: /resources_test/10x_5k_lung_crispr_v10
  - path: /resources_test/10x_5k_beam
  - path: /resources_test/10x_5k_beam_v10
  - path: /resources_test/10x_5k_fixed
  - path: /resources_test/10x_5k_fixed_v10
  - path: /resources_test/10x_4plex_dtc
  - path: /resources_test/10x_4plex_dtc_v10
engines:
  - type: docker
    image: python:3.13-slim
    setup:
      - type: apt
        packages: 
          - procps
      - type: python
        __merge__: [/src/base/requirements/anndata_mudata.yaml, /src/base/requirements/scanpy.yaml, .]
        packages:
          - scirpy
    test_setup:
      - type: python
        __merge__: [ /src/base/requirements/viashpy.yaml, .]
runners:
  - type: executable
  - type: nextflow
    directives:
      label: [lowmem, singlecpu]
