diffsvg.tl.one_vs_rest#

diffsvg.tl.one_vs_rest(adata, gene, curves_key='dsvg_curves', profiles_key='dsvg_profiles', null_quantile=0.9, inplace=False, key_added=None, tau=0.1)#

Compare one gene’s expression profile against every other gene’s.

Each gene is reduced to a single curve along anchor (see _gene_profiles), and the probe gene is then tested against each of the remaining genes individually.

With a fit_profiles result (which stores each gene’s posterior covariance of its spline coefficients) every pair gets the parallel-curves test of parallel_curves_test: do the two genes’ curves differ in shape, beyond tau, rather than only in level? The covariance of the difference is the sum of the two genes’ posterior covariances (their fits are independent). Without it (curves averaged from fit_model), the pairs are ranked by T against a Gamma null fitted to the “rest” genes.

Parameters:
adata

Annotated data matrix that fit_profiles or fit_model wrote into.

gene

The probe gene, i.e. the “one” in one-vs-rest.

curves_key default: 'dsvg_curves'

adata.varm prefixes written by fit_model / fit_profiles. An explicit fit_profiles result wins when both are present.

profiles_key default: 'dsvg_profiles'

adata.varm prefixes written by fit_model / fit_profiles. An explicit fit_profiles result wins when both are present.

null_quantile default: 0.9

Only without a fit_profiles result: fraction of the “rest” genes assumed to follow the null; the Gamma null is fitted to the lower null_quantile of their T values, as a truncated sample (see _gamma_null_pvalues).

inplace default: False

If True, also write the table to adata.varm[key_added] (reindexed to adata.var_names, so the probe gene’s own row is NaN). The table is returned either way.

key_added default: None

adata.varm key used when inplace; defaults to f"dsvg_ovr_{gene}".

tau default: 0.1

Smallest shape difference between two genes’ curves that counts, as in parallel_curves_test.

Returns:

pandas.DataFrame Indexed by the “rest” genes, with delta (the signed area between the probe curve and that gene’s, negative when the probe sits below it) and T; with a fit_profiles result shape_diff, parallel_stat, parallel_pval and parallel_pval_adj, otherwise the Gamma-null gamma_pval and gamma_pval_adj.