FACSPy.convert_gate_to_obs#
- FACSPy.convert_gate_to_obs(adata, gate, key_added=None, copy=False)#
Converts the gate information stored in .obsm[“gating”] into an .obs column.
- Parameters:
adata (
AnnData) – The anndata object of shape n_obs x n_vars where rows correspond to cells and columns to the channels.gate (
str) – The gate to transfer. Must be in adata.uns[“gating_cols”]. Can be specified as a population, as a partial gate path or a full gate path. Also allows for gate aliasing. If a gate alias is provided, pass the key_added parameter in order to pass that alias forward. Otherwise, the full gate path is used for the .obs column.key_added (
Optional[str]) – The name of the corresponding .obs column. Positive events will be stored as specified in key_added, negative events will be stored as other.copy (
bool) – Whether to copy the dataset.
- Return type:
AnnDataor None, depending on copy.
Examples
>>> import FACSPy as fp >>> dataset = fp.create_dataset(...) >>> fp.convert_gate_to_obs(dataset, "CD45+", key_added = "leukocytes") >>> fp.tl.pca(dataset, gate = "live", layer = "compensated") >>> fp.pl.pca(dataset, color = "leukocytes")