campmc.preprocess#
- campmc.preprocess(adata, *, min_genes=200, min_cells=3, n_hvg=2000, n_pcs=50, target_sum=10000.0, copy=False)#
Filter, normalize, select HVGs, and compute PCA.
Expects raw (or non-negative) counts in
adata.X. After this call,adata.obsm['X_pca']is ready forpartition().- Parameters:
- adata
AnnData Annotated data matrix with count-like values in
X.- min_genes
int(default:200) Minimum genes expressed per cell (passed to
scanpy.pp.filter_cells).- min_cells
int(default:3) Minimum cells expressing a gene (passed to
scanpy.pp.filter_genes).- n_hvg
int(default:2000) Number of highly variable genes to retain.
- n_pcs
int(default:50) Number of principal components to compute.
- target_sum
float(default:10000.0) Target library size for
scanpy.pp.normalize_total.- copy
bool(default:False) If
True, operate on a copy and return it; otherwise modifyadatain place and returnNone.
- adata
- Return type:
- Returns:
AnnData | None Updated object if
copy=True, elseNone.
Notes
Negative values in
X(e.g. from prior scaling) are clipped to zero before normalization. The object is subset to HVGs and scaled before PCA.Examples
import campmc as cp import scanpy as sc adata = sc.datasets.pbmc3k() cp.preprocess(adata, n_hvg=500, n_pcs=30) adata.obsm["X_pca"].shape
(2700, 30)