scFates.tl.linearity_deviation

scFates.tl.linearity_deviation(adata, start_milestone, end_milestone, percentiles=[20, 80], n_jobs=1, n_map=1, plot=False, basis='X_umap', copy=False)

Identifies genes that specifically characterize a given transition but not the progenitors neither the progenies.

This approach has been developped in the following study [Kameneva21]. Designed to test whether a bridge/transition is the result of a doublet population only, this test checks if a gene expression occuring in the transition/bridge could be explained by a linear mixture of expressions of that gene in progenitors and progenies. The gene expression profile of each cell of the bridge is modeled as a linear combination of mean gene expression profiles in progenitors and progenies.

For each gene in each cell in bridge is calculated the magnitude of the residuals not explained by the model. The mean residuals across all cells in the transition/bridge is then normalized to the standard deviation of the expression of a given gene. The obtained normalized mean residual values is used to prioritize the genes with distinctive expression patterns in the bridge population.

Parameters
adata : AnnData

Annotated data matrix.

start_milestone

tip defining progenitor branch.

end_milestone

tips defining the progeny branch.

percentiles

pseudotime percentiles to define the progenitor and progeny populations

n_jobs : int (default: 1)

number of cpu processes used to perform the test.

n_map : int (default: 1)

number of cell mappings from which to do the test.

plot : bool (default: False)

plot the cells selection according to percentiles.

basis : str (default: 'X_umap')

basis to use in case of plotting

copy : bool (default: False)

Return a copy instead of writing to adata.

Returns

adata – if copy=True it returns subsetted or else subset (keeping only significant features) and add fields to adata:

.var[‘A->B_rss’]

pearson residuals of the linear fit.

.obs[‘A->B_lindev_sel’]

cell selections used for the test.

Return type

anndata.AnnData