STAVAG.TVG_detection
- STAVAG.TVG_detection(adata, coords, sps=False, threshold=0.05, num_perm=1)[source]
Detect Temporally Variable Genes (TVGs) using regression on a 1D time coordinate.
- Parameters:
adata (AnnData) – An AnnData object containing gene expression matrix
adata.Xand gene namesadata.var.index.coords (ndarray) – 1D temporal coordinate of cells with shape
(n_cells, 1).sps (bool, optional) – If True and num_perm == 1, compute STAVAG priority scores by comparing observed importances with a single random baseline (original behavior). Defaults to False.
threshold (float, optional) –
If num_perm == 1: cutoff used by
keep_variant_genesto select TVGs based on importance.If num_perm > 1: p-value cutoff; genes with pval <= threshold are kept.
Defaults to 0.05.
num_perm (int, optional) –
Number of permutations used to build an empirical null distribution of feature importances. - If 1: keep the original single-permutation behavior. - If > 1: must be >= 100; empirical permutation p-values are computed
for each gene.
- Returns:
Dictionary containing important genes over the time axis
'T'.For num_perm == 1: same structure as before (with SPS scores if sps=True), already filtered by the given threshold.
For num_perm > 1: the DataFrame under key ‘T’ contains columns: [‘Feature’, ‘Importance’, ‘null_mean’, ‘pval’] and is filtered by p-value (<= threshold).
- Return type:
Dict[str, DataFrame]