cytopy.data.population¶
When analysing single cell data we are ultimately interested in populations of cells. This module contains the Population class, which controls the data attaining to a single cell population. A FileGroup (see cytopy.data.fcs) can contain many Populations (which are embedded within the FileGroup).
Copyright 2020 Ross Burton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Classes:
|
A population of cells identified by either a gate, clustering or supervised algorithm. |
Functions:
|
Merge two Population’s. |
|
Merge multiple Population’s. |
|
Merge populations arising from classification or clustering. |
-
class
cytopy.data.population.
Population
(*args, **kwargs)¶ A population of cells identified by either a gate, clustering or supervised algorithm. Stores the index of events corresponding to a single population, where the index relates back to the primary data in the FileGroup in which a population is embedded.
-
population_name
¶ name of population
- Type
str, required
-
n
¶ number of events associated to this population
- Type
int
-
parent
¶ name of parent population
- Type
str, required, (default: “root”)
-
prop_of_parent
¶ proportion of events as a percentage of parent population
- Type
float, required
-
prop_of_total
¶ proportion of events as a percentage of all events
- Type
float, required
-
warnings
¶ list of warnings associated to population
- Type
list, optional
-
geom
¶ PopulationGeometry (see cytopy.data.geometry) that defines the gate that captures this population.
- Type
-
definition
¶ relevant for populations generated by a ThresholdGate; defines the source of this population e.g. “+” for a 1D threshold or “+-” for a 2D threshold
- Type
str
-
index
¶ numpy array storing index of events that belong to population
- Type
numpy.ndarray
-
signature
¶ average of a population feature space (median of each channel); used to match children to newly identified populations for annotating
- Type
dict
-
source
¶ Source of the population i.e. what method was used to generate it. Valid choices are: “gate”, “cluster”, “root”, or “classifier”
- Type
str, required
-
-
cytopy.data.population.
merge_gate_populations
(left: cytopy.data.population.Population, right: cytopy.data.population.Population, new_population_name: Optional[str] = None)¶ Merge two Population’s. The indexes and signatures of these populations will be merged. The populations must have the same geometries.
- Parameters
left (Population) –
right (Population) –
new_population_name (str) –
- Returns
- Return type
- Raises
AssertionError – Invalid populations provided
-
cytopy.data.population.
merge_multiple_gate_populations
(populations: List[cytopy.data.population.Population], new_population_name: Optional[str] = None)¶ Merge multiple Population’s. The indexes and signatures of these populations will be merged. The populations must have the same geometries.
- Parameters
populations (list) –
new_population_name (str) –
- Returns
- Return type
- Raises
AssertionError – Invalid populations provided
-
cytopy.data.population.
merge_non_geom_populations
(populations: list, new_population_name: str)¶ Merge populations arising from classification or clustering. Takes a list of Population objects and the name for the new population and merges their indexes, forming a new Population object.
- Parameters
populations (list) –
new_population_name (str) –
- Returns
- Return type
- Raises
AssertionError – Invalid populations provided