FACSPy.convert_cluster_to_gate

FACSPy.convert_cluster_to_gate#

FACSPy.convert_cluster_to_gate(adata, cluster_key, positive_cluster, population_name, parent_name, copy=False)#

Converts cluster information to gates. Select positive clusters and define a population from the positive clusters. The population will be added as a gate to perform analyses on.

Parameters:
  • adata (AnnData) – The anndata object of shape n_obs x n_vars where rows correspond to cells and columns to the channels.

  • cluster_key (str) – The name of the .obs columns where the cluster information is stored.

  • positive_cluster (Union[list[int], list[str], int, str]) – The values of the clusters to be defined as a population. In order to select multiple clusters, pass a list.

  • name (population) – The name of the newly defined population.

  • parent_name (str) – The name of the parent population in order to define a bona-fide gating path.

  • copy (bool) – Whether to copy the dataset.

Return type:

AnnData or None, depending on copy.

Examples

>>> import FACSPy as fp
>>> dataset = fp.create_dataset(...)
>>> fp.settings.default_gate = "CD45+"
>>> fp.settings.default_layer = "transformed"
>>> fp.tl.pca(dataset)
>>> fp.tl.neighbors(dataset)
>>> fp.tl.parc(dataset)
>>> fp.convert_cluster_to_gate(
...     dataset,
...     cluster_key = "CD45+_transformed_parc",
...     positive_cluster = ["1", "4", "6"],
...     population_name = "Neutrophils",
...     parent_name = "CD45+"
... )