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_profilesresult (which stores each gene’s posterior covariance of its spline coefficients) every pair gets the parallel-curves test ofparallel_curves_test: do the two genes’ curves differ in shape, beyondtau, 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 fromfit_model), the pairs are ranked byTagainst a Gamma null fitted to the “rest” genes.- Parameters:
- adata
Annotated data matrix that
fit_profilesorfit_modelwrote into.- gene
The probe gene, i.e. the “one” in one-vs-rest.
- curves_key default:
'dsvg_curves' adata.varmprefixes written byfit_model/fit_profiles. An explicitfit_profilesresult wins when both are present.- profiles_key default:
'dsvg_profiles' adata.varmprefixes written byfit_model/fit_profiles. An explicitfit_profilesresult wins when both are present.- null_quantile default:
0.9 Only without a
fit_profilesresult: fraction of the “rest” genes assumed to follow the null; the Gamma null is fitted to the lowernull_quantileof theirTvalues, as a truncated sample (see_gamma_null_pvalues).- inplace default:
False If
True, also write the table toadata.varm[key_added](reindexed toadata.var_names, so the probe gene’s own row isNaN). The table is returned either way.- key_added default:
None adata.varmkey used wheninplace; defaults tof"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) andT; with afit_profilesresultshape_diff,parallel_stat,parallel_pvalandparallel_pval_adj, otherwise the Gamma-nullgamma_pvalandgamma_pval_adj.