name: "bbknn_leiden"
namespace: "workflows/integration"
scope: "public"
description: "Run bbknn followed by leiden clustering and run umap on the result."
info:
  test_dependencies:
authors:
  - __merge__: /src/authors/mauro_saporita.yaml
    roles: [ author ]
  - __merge__: /src/authors/povilas_gibas.yaml
    roles: [ author ]
argument_groups:
  - name: "Inputs"
    arguments:
      - name: "--id"
        required: true
        type: string
        description: ID of the sample.
        example: foo
      - name: "--input"
        required: true
        type: file
        description: Path to the sample.
        example: dataset.h5mu
      - name: "--layer"
        default: "log_normalized"
        type: string
        description: use specified layer for expression values instead of the .X object from the modality.
        required: false
      - name: "--modality"
        description: Which modality to process.
        type: string
        default: "rna"
        required: false
  - name: "Outputs"
    arguments:
      - name: "--output"
        type: file
        required: true
        direction: output
        description: Destination path to the output.
        example: output.h5mu
  - name: Bbknn
    arguments:
      - name: "--obsm_input"
        description: The dimensionality reduction in `.obsm` to use for neighbour detection. Defaults to X_pca.
        type: string
        default: "X_pca"
      - name: "--obs_batch"
        type: string
        description: .obs column name discriminating between your batches.
        default: "sample_id"
      - name: "--uns_output"
        type: string
        default: "bbknn_integration_neighbors"
        description: Mandatory .uns slot to store various neighbor output objects.
      - name: "--obsp_distances"
        type: string
        default: "bbknn_integration_distances"
        description: "In which .obsp slot to store the distance matrix between the resulting neighbors."
      - name: "--obsp_connectivities"
        type: string
        default: "bbknn_integration_connectivities"
        description: "In which .obsp slot to store the connectivities matrix between the resulting neighbors."
      - name: "--n_neighbors_within_batch"
        type: integer
        description: How many top neighbours to report for each batch; total number of neighbours in the initial k-nearest-neighbours computation will be this number times the number of batches.
        default: 3
      - name: "--n_pcs"
        type: integer
        description: How many dimensions (in case of PCA, principal components) to use in the analysis.
        default: 50
      - name: "--n_trim"
        type: integer
        description: Trim the neighbours of each cell to these many top connectivities. May help with population independence and improve the tidiness of clustering. The lower the value the more independent the individual populations, at the cost of more conserved batch effect. If `None` (default), sets the parameter value automatically to 10 times `neighbors_within_batch` times the number of batches. Set to 0 to skip.
  - name: Clustering options
    arguments:
      - name: "--obs_cluster"
        type: string
        description: |
          Prefix for the .obs keys under which to add the cluster labels. Newly created columns in .obs will 
          be created from the specified value for '--obs_cluster' suffixed with an underscore and one of the resolutions
          resolutions specified in '--leiden_resolution'.          
        default: "bbknn_integration_leiden"
      - name: "--leiden_resolution"
        type: double
        description: Control the coarseness of the clustering. Higher values lead to more clusters.
        default: [1]
        multiple: true
  - name: UMAP options
    arguments:
      - name: "--obsm_umap"
        type: string
        default: "X_leiden_bbknn_umap"
        required: false
        description: "In which .obsm slot to store the resulting UMAP embedding."
resources:
  - type: nextflow_script
    path: main.nf
    entrypoint: run_wf
  - type: file
    path: /src/workflows/utils/
test_resources:
  - type: nextflow_script
    path: test.nf
    entrypoint: test_wf
  - type: nextflow_script
    path: test.nf
    entrypoint: test_wf2
  - path: /resources_test/pbmc_1k_protein_v3
dependencies:
  - name: cluster/leiden
  - name: dimred/umap
  - name: neighbors/bbknn
  - name: metadata/move_obsm_to_obs 
runners:
  - type: nextflow