FACSPy.tl.scanorama_integrate#
- FACSPy.tl.scanorama_integrate(adata, gate, layer, key, basis='pca', adjusted_basis='scanorama', knn=20, sigma=15, approx=True, alpha=0.1, batch_size=5000, copy=False, **kwargs)#
Computes scanorama integration.
- Parameters:
adata (
AnnData) – The anndata object of shape n_obs x n_vars where rows correspond to cells and columns to the channelsgate (
str) – The gate to be analyzed, called by the population name. This parameter has a default stored in fp.settings, but can be superseded by the user.layer (
str) – The layer corresponding to the data matrix. Similar to the gate parameter, it has a default stored in fp.settings which can be overwritten by user input.key (
str) – Column in .obs that specifies the batch.basis (
str) – Entry in .obsm that specifies the embedding.adjusted_basis (
str) – Name of the integrated embedding.knn (
int) – Number of nearest neighbors to use for matching.sigma (
float) – Correction smoothing parameter on Gaussian kernel.approx (
bool) – Use approximate nearest neighbors with Pythonannoy; greatly speeds up matching runtime.alpha (
float) – Alignment score minimum cutoff.batch_size (
int) –The batch size used in the alignment vector computation. Useful when integrating very large (>100k samples) datasets. Set to large value that runs within available memory.
Return a copy of adata instead of modifying inplace.
**kwargs (dict, optional) – keyword arguments that are passed directly to the scanorama.scanorama function. Please refer to its documentation.
- Returns:
Returns adata if copy = True, otherwise adds fields to the anndata object:
- .obsm[adjusted_basis]
integrated embedding of the data
- Return type:
AnnDataor None
Examples
>>> import FACSPy as fp >>> dataset AnnData object with n_obs × n_vars = 615936 × 22 obs: 'sample_ID', 'file_name', 'condition', 'sex', 'batch' var: 'pns', 'png', 'pne', 'pnr', 'type', 'pnn', 'cofactors' uns: 'metadata', 'panel', 'workspace', 'gating_cols', 'dataset_status_hash' obsm: 'gating' layers: 'compensated', 'transformed' >>> fp.settings.default_gate = "T_cells" >>> fp.settings.default_layer = "transformed" >>> fp.tl.pca(dataset) >>> fp.tl.scanorama_integrate( ... dataset, ... basis = "X_pca_T_cells_transformed", ... adjusted_basis = "X_pca_T_cells_transformed_scanorama", ... )