{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "scvi_knn",
  "description": "\"Cell type annotation workflow that performs scVI integration of reference and query dataset followed by KNN label transfer. \nThe query and reference datasets are expected to be pre-processed in the same way, for example with the `process_samples` workflow of OpenPipeline.\nNote that this workflow will integrate the reference dataset from scratch and integrate the query dataset in the same embedding space. \nThe workflow does not currently output the trained SCVI reference model.\"\n",
  "type": "object",
  "$defs": {
    "outputs": {
      "title": "Outputs",
      "type": "object",
      "description": "No description",
      "properties": {
        "output": {
          "type": "string",
          "format": "path",
          "description": "The annotated output .h5mu file.",
          "help_text": "Type: `file`, multiple: `False`, required, default: `\"$id.$key.output.h5mu\"`, direction: `output`, example: `\"output.h5mu\"`. ",
          "default": "$id.$key.output.h5mu"
        },
        "output_obs_predictions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "In which `.obs` slots to store the predicted cell labels.\nIf provided, must have the same length as `--reference_obs_targets`.\nIf empty, will default to the `reference_obs_targets` combined with the `\"_pred\"` suffix.\n",
          "help_text": "Type: `string`, multiple: `True`. "
        },
        "output_obs_probability": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "In which `.obs` slots to store the probability of the predictions.\nIf provided, must have the same length as `--reference_obs_targets`.\nIf empty, will default to the `reference_obs_targets` combined with the `\"_probability\"` suffix.\n",
          "help_text": "Type: `string`, multiple: `True`. "
        },
        "output_obsm_integrated": {
          "type": "string",
          "description": "In which .obsm slot to store the integrated embedding.",
          "help_text": "Type: `string`, multiple: `False`, default: `\"X_integrated_scvi\"`. ",
          "default": "X_integrated_scvi"
        }
      }
    },
    "query input": {
      "title": "Query Input",
      "type": "object",
      "description": "No description",
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the sample.",
          "help_text": "Type: `string`, multiple: `False`, required, example: `\"foo\"`. "
        },
        "input": {
          "type": "string",
          "format": "path",
          "exists": true,
          "description": "Input dataset consisting of the (unlabeled) query observations.",
          "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"input.h5mu\"`. "
        },
        "modality": {
          "type": "string",
          "description": "Which modality to process",
          "help_text": "Type: `string`, multiple: `False`, default: `\"rna\"`. ",
          "default": "rna"
        },
        "input_layer": {
          "type": "string",
          "description": "The layer of the input dataset containing the raw counts if .X is not to be used.",
          "help_text": "Type: `string`, multiple: `False`, example: `\"counts\"`. "
        },
        "input_layer_lognormalized": {
          "type": "string",
          "description": "The layer of the input dataset containing the lognormalized counts if .X is not to be used.",
          "help_text": "Type: `string`, multiple: `False`, example: `\"log_normalized\"`. "
        },
        "input_obs_batch_label": {
          "type": "string",
          "description": "The .obs field in the input (query) dataset containing the batch labels.",
          "help_text": "Type: `string`, multiple: `False`, required, example: `\"sample\"`. "
        },
        "input_var_gene_names": {
          "type": "string",
          "description": "The .var field in the input (query) dataset containing gene names; if not provided, the .var index will be used.\n",
          "help_text": "Type: `string`, multiple: `False`. "
        },
        "input_reference_gene_overlap": {
          "type": "integer",
          "description": "The minimum number of genes present in both the reference and query datasets.\n",
          "help_text": "Type: `integer`, multiple: `False`, default: `100`. ",
          "default": 100
        },
        "overwrite_existing_key": {
          "type": "boolean",
          "description": "If provided, will overwrite existing fields in the input dataset when data are copied during the reference alignment process.",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        },
        "sanitize_ensembl_ids": {
          "type": "boolean",
          "description": "Whether to sanitize ensembl ids by removing version numbers.",
          "help_text": "Type: `boolean`, multiple: `False`, default: `true`. ",
          "default": true
        }
      }
    },
    "reference input": {
      "title": "Reference input",
      "type": "object",
      "description": "No description",
      "properties": {
        "reference": {
          "type": "string",
          "format": "path",
          "exists": true,
          "description": "Reference dataset consisting of the labeled observations.",
          "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"reference.h5mu\"`. "
        },
        "reference_layer": {
          "type": "string",
          "description": "The layer of the reference dataset containing the raw counts if .X is not to be used.",
          "help_text": "Type: `string`, multiple: `False`, example: `\"counts\"`. "
        },
        "reference_layer_lognormalized": {
          "type": "string",
          "description": "The layer of the reference dataset containing the lognormalized counts if .X is not to be used.",
          "help_text": "Type: `string`, multiple: `False`, example: `\"log_normalized\"`. "
        },
        "reference_obs_target": {
          "type": "string",
          "description": "The `.obs` key(s) of the target labels to transfer.",
          "help_text": "Type: `string`, multiple: `False`, required, example: `\"cell_type\"`. "
        },
        "reference_var_gene_names": {
          "type": "string",
          "description": "The .var field in the reference dataset containing gene names; if not provided, the .var index will be used.\n",
          "help_text": "Type: `string`, multiple: `False`. "
        },
        "reference_obs_batch_label": {
          "type": "string",
          "description": "The .obs field in the reference dataset containing the batch labels.",
          "help_text": "Type: `string`, multiple: `False`, required, example: `\"sample\"`. "
        }
      }
    },
    "hvg subset arguments": {
      "title": "HVG subset arguments",
      "type": "object",
      "description": "No description",
      "properties": {
        "n_hvg": {
          "type": "integer",
          "description": "Number of highly variable genes to subset for.\n",
          "help_text": "Type: `integer`, multiple: `False`, default: `2000`. ",
          "default": 2000
        }
      }
    },
    "scvi integration options": {
      "title": "scVI integration options",
      "type": "object",
      "description": "No description",
      "properties": {
        "scvi_early_stopping": {
          "type": "boolean",
          "description": "Whether to perform early stopping with respect to the validation set.",
          "help_text": "Type: `boolean`, multiple: `False`. "
        },
        "scvi_early_stopping_monitor": {
          "type": "string",
          "description": "Metric logged during validation set epoch.",
          "help_text": "Type: `string`, multiple: `False`, default: `\"elbo_validation\"`, choices: ``elbo_validation`, `reconstruction_loss_validation`, `kl_local_validation``. ",
          "enum": [
            "elbo_validation",
            "reconstruction_loss_validation",
            "kl_local_validation"
          ],
          "default": "elbo_validation"
        },
        "scvi_early_stopping_patience": {
          "type": "integer",
          "description": "Number of validation epochs with no improvement after which training will be stopped.",
          "help_text": "Type: `integer`, multiple: `False`, default: `45`. ",
          "default": 45
        },
        "scvi_early_stopping_min_delta": {
          "type": "number",
          "description": "Minimum change in the monitored quantity to qualify as an improvement, i.e",
          "help_text": "Type: `double`, multiple: `False`, default: `0.0`. ",
          "default": 0.0
        },
        "scvi_max_epochs": {
          "type": "integer",
          "description": "Number of passes through the dataset, defaults to (20000 / number of cells) * 400 or 400; whichever is smallest.",
          "help_text": "Type: `integer`, multiple: `False`. "
        },
        "scvi_reduce_lr_on_plateau": {
          "type": "boolean",
          "description": "Whether to monitor validation loss and reduce learning rate when validation set `lr_scheduler_metric` plateaus.",
          "help_text": "Type: `boolean`, multiple: `False`, default: `true`. ",
          "default": true
        },
        "scvi_lr_factor": {
          "type": "number",
          "description": "Factor to reduce learning rate.",
          "help_text": "Type: `double`, multiple: `False`, default: `0.6`. ",
          "default": 0.6
        },
        "scvi_lr_patience": {
          "type": "number",
          "description": "Number of epochs with no improvement after which learning rate will be reduced.",
          "help_text": "Type: `double`, multiple: `False`, default: `30.0`. ",
          "default": 30.0
        }
      }
    },
    "leiden clustering options": {
      "title": "Leiden clustering options",
      "type": "object",
      "description": "No description",
      "properties": {
        "leiden_resolution": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "Control the coarseness of the clustering",
          "help_text": "Type: `double`, multiple: `True`, default: `[1.0]`. ",
          "default": [
            1.0
          ]
        }
      }
    },
    "neighbor classifier arguments": {
      "title": "Neighbor classifier arguments",
      "type": "object",
      "description": "No description",
      "properties": {
        "knn_weights": {
          "type": "string",
          "description": "Weight function used in prediction",
          "help_text": "Type: `string`, multiple: `False`, default: `\"uniform\"`, choices: ``uniform`, `distance``. ",
          "enum": [
            "uniform",
            "distance"
          ],
          "default": "uniform"
        },
        "knn_n_neighbors": {
          "type": "integer",
          "description": "The number of neighbors to use in k-neighbor graph structure used for fast approximate nearest neighbor search with PyNNDescent",
          "help_text": "Type: `integer`, multiple: `False`, default: `15`. ",
          "default": 15
        }
      }
    },
    "nextflow input-output arguments": {
      "title": "Nextflow input-output arguments",
      "type": "object",
      "description": "Input/output parameters for Nextflow itself. Please note that both publishDir and publish_dir are supported but at least one has to be configured.",
      "properties": {
        "publish_dir": {
          "type": "string",
          "description": "Path to an output directory.",
          "help_text": "Type: `string`, multiple: `False`, required, example: `\"output/\"`. "
        }
      }
    }
  },
  "allOf": [
    {
      "$ref": "#/$defs/outputs"
    },
    {
      "$ref": "#/$defs/query input"
    },
    {
      "$ref": "#/$defs/reference input"
    },
    {
      "$ref": "#/$defs/hvg subset arguments"
    },
    {
      "$ref": "#/$defs/scvi integration options"
    },
    {
      "$ref": "#/$defs/leiden clustering options"
    },
    {
      "$ref": "#/$defs/neighbor classifier arguments"
    },
    {
      "$ref": "#/$defs/nextflow input-output arguments"
    }
  ]
}
