scmorph.pp.select_features

scmorph.pp.select_features#

scmorph.pp.select_features(adata, method='pearson', cor_cutoff=0.9, fraction=None, n_obs=None, copy=False)[source]#

Feature selection based on correlation metrics.

This can be useful for reducing the number of features in highly correlated profiling data. However, note that if using scmorph for hit calling, this may not be necesary, as ~scmorph.tl.get_ks` operates on PCA-space, which reduces the impact of feature correlation. Nevertheless, performing this step may improve downstream results and speed up computations.

Select features by feature correlations. Allows measuring correlation on a subset of cells to speed up computations. See fraction and n_obs for details.

Parameters:
adata AnnData

The (annotated) data matrix of shape n_obs × n_vars. Rows correspond to cells and columns to genes.

method str (default: 'pearson')

Which correlation coefficient to use for filtering. One of “pearson”, “spearman” and “chatterjee” ([[Lin and Han, n.d.]]_)

cor_cutoff float (default: 0.9)

Cutoff beyond which features with a correlation coefficient higher than it are removed. Must be between 0 and 1.

fraction float | None (default: None)

Subsample to this fraction of the number of observations.

n_obs int | None (default: None)

Subsample to this number of observations.

copy bool (default: False)

Whether to return a copy or modify adata inplace (i.e. operate inplace)

Return type:

AnnData | None

Returns:

Feature correlations saved in .varm slot and feature selection saved in .var slot.