Skip to content

Analysis API

All analysis endpoints require an authenticated account with FEATURE_ANALYSIS. Group CRUD is available below that tier because comparison features use the same groups, but the analysis endpoints themselves are enterprise-gated.

Base: your Explorer URL. Send Authorization: Bearer $MALVA_API_TOKEN or use a browser session.

Populations

Method Path Purpose
GET /api/groups List populations.
POST /api/groups Create a population from filter_definition.
PATCH /api/groups/<id> Rename or recolor a population.
DELETE /api/groups/<id> Delete a group.
POST /api/groups/<id>/share Create a share token.
DELETE /api/groups/<id>/share Revoke the share token.

Create body:

{
  "name": "B cells",
  "description": "B-cell populations",
  "dataset_id": "Human_Cell_Atlas",
  "color": "#2f6f5e",
  "filter_definition": {
    "filters": {
      "cell_type": ["B cell", "plasma cell"],
      "specimen_from_organism.organ": ["lung"]
    },
    "logic": "and"
  }
}

cell_type filters resolve to cell-level IDs; all other metadata columns resolve to sample IDs. The response group includes n_cells, n_metacells, distribution summaries and filter_definition.

Markers

POST /api/groups/<id>/markers

{"top_n_genes": 50, "include_go": true}

Returns a task id. Poll GET /api/analysis/tasks/<task_id>; once status is completed, the result contains marker rows with gene, specificity, pct_in, p_value, cooccurrence and GO terms.

Differential expression

POST /api/groups/differential

{"group_a": "<reference group id>", "group_b": "<comparison group id>", "dataset_id": "Human_Cell_Atlas"}

Returns a task id. The completed result contains genes with log2_fold_change, mean_a, mean_b, pct_a, pct_b, p_value, adjusted_p_value and auc, plus GO enrichment. The Explorer requests all genes (top_n_genes: 0).

If a group has no metacells, the Explorer falls back to the cell-ID route internally.

Matrix

POST /api/groups/matrix

{"group_ids": ["<id>", "<id>"], "top_n": 30}

Completed result contains per-group expression vectors for heatmap rendering.

Gene expression

POST /api/groups/expression

{"group_ids": ["<id>"], "gene": "CD3D"}

Returns per-cell-type expression distributions for the gene.

Task polling

GET /api/analysis/tasks/<task_id> returns {status, progress, step_description, result?}. GET /api/analysis/tasks?limit=20 lists recent tasks. Tasks are kept in the durable task store and may briefly 404 during an Explorer restart.

Metadata browser

POST /api/metadata/groups

{
  "columns": ["specimen_from_organism.diseases", "specimen_from_organism.organ"],
  "filters": {"specimen_from_organism.diseases": ["Alzheimer disease"]},
  "num_filters": {"num_cells": {"min": 1000, "max": 50000}},
  "limit": 100000,
  "include_sample_ids": false
}

Returns groups with values, n_cells, n_samples and optionally sample_ids (capped at 500 per group). The Analysis Finder requests one column at a time with the previous path as filters. num_filters applies numeric ranges to the sample rows before grouping and works for columns that are not displayed in the Finder. Population creation accepts the same num_filters key inside filter_definition.

GET /analysis/shared/<token> renders a read-only view of one group. Mutating actions are disabled for shared viewers.