name: move_mudata_obs_to_tiledb
namespace: tiledb
scope: "private"
description: |
  Move .obs columns from a MuData modality to an existing tileDB database.
  The .obs keys should not exist in the database yet; and the observations from the modality and 
  their order should match with what is already present the tiledb database.
authors:
  - __merge__: /src/authors/dries_schaumont.yaml
    roles: [ author, maintainer ]
argument_groups:
  - name: Input database
    description: "Open a tileDB-SOMA database by URI or as a local directory."
    arguments:
      - name: "--input_uri"
        type: string
        description: "A URI pointing to a TileDB-SOMA database. Mutually exclusive with 'input_dir'"
        required: false
        example: "s3://bucket/path"
      - name: "--input_dir"
        type: file
        required: false
        description: "Path to a TileDB-SOMA database as a local directory"
        example: "./tiledb_database"
      - name: "--s3_region"
        description: |
          Region where the TileDB-SOMA database is hosted.
        type: string
        required: false
      - name: "--endpoint"
        type: string
        description: |
          Custom endpoint to use to connect to S3
        required: false
      - name: "--s3_no_sign_request"
        description: | 
          Do not sign S3 requests. Credentials will not be loaded if this argument is provided.
        type: boolean
        default: false
      - name: "--output_modality"
        type: string
        description: |
          TileDB-SOMA measurement to add the output to.
      - name: "--obs_index_name_input"
        description: |
          Name of the index that is used to describe the cells (observations).
        type: string
        default: cell_id
  - name: "MuData input"
    arguments:
      - name: "--input_mudata"
        type: file
        required: true
        description: |
          MuData object to take the columns from. The observations and their order should
          match between the database and the input modality.
      - name: "--modality"
        required: true
        type: string
        description: |
          Modality where to take the .obs from.
      - name: "--obs_input"
        type: string
        multiple: true
        description: |
          Columns from .obs to copy. The keys should not be present yet in the database.
  - name: "TileDB-SOMA output"
    arguments:
      - name: "--output_tiledb"
        type: file
        direction: output
        required: False
        description: |
          Output to a directory instead of adding to the existing database.
resources:
  - type: python_script
    path: script.py
  - path: /src/utils/setup_logger.py
test_resources:
  - type: python_script
    path: test.py
  - path: /resources_test/tiledb/
  - path: /resources_test/pbmc_1k_protein_v3/
engines:
  - type: docker
    image: python:3.12
    setup:
      - type: python
        packages:
          - tiledbsoma
          - boto3
          - awscli
        __merge__: /src/base/requirements/anndata_mudata.yaml
    test_setup:
      - type: python
        packages:
          - moto[server]
    __merge__: [ /src/base/requirements/python_test_setup.yaml, .]
runners:
  - type: executable
    docker_run_args: ["--env", "AWS_ACCESS_KEY_ID", "--env", "AWS_SECRET_ACCESS_KEY", "--env", "AWS_DEFAULT_REGION"]
  - type: nextflow
    directives:
      label: [highmem, midcpu]