compute_heritability
Rank features by heritability on a lineage tree using Moran's I or Geary's C autocorrelation. Identifies which genes are most heritable on the tree.
Instructions
Rank features by heritability on a tree (Moran's I / Geary's C autocorrelation).
Answers "which genes are most heritable on this lineage tree?". Builds tree neighbors, then computes spatial autocorrelation of each feature over that graph. Requires an expression/feature matrix in .X (or a named layer): var_names are the features scored. Results are also stored in tdata.uns["moranI"]/["gearyC"].
Args: dataset_id: Dataset handle. tree_key: Which tree in obst to use. keys: Feature names to score (default: all var_names). n_neighbors: Number of tree neighbors per cell for the connectivity graph. method: "moran" (Moran's I) or "geary" (Geary's C). layer: Optional layer to use instead of .X. top_n: Number of top-ranked features to return.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keys | No | ||
| layer | No | ||
| top_n | No | ||
| method | No | moran | |
| tree_key | Yes | ||
| dataset_id | Yes | ||
| n_neighbors | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | Yes | Features ranked by heritability (most heritable first). | |
| method | Yes | 'moran' or 'geary'. | |
| tree_key | Yes | ||
| dataset_id | Yes | ||
| n_features | Yes |