anndata_fcs#
Attributes#
Functions#
|
Create fcs object from anndata. |
|
Converts FlowData instance to AnnData object. |
|
Converts FlowData instance to pandas DataFrame. |
|
Gate channel |
|
Gating polygon on flow data object and returning subset. |
|
Plot scatter from FCS data. |
Package Contents#
- anndata_fcs.anndata_to_fcs(adata)#
Create fcs object from anndata.
- Parameters:
adata (anndata.AnnData) – AnnData object to convert.
- Returns:
FlowData instance.
- Return type:
- Raises:
AssertionError – If array conversion fails.
- anndata_fcs.fcs_to_anndata(fdata, include_metadata=True)#
Converts FlowData instance to AnnData object.
- Parameters:
fdata (flowio.FlowData) – FlowData instance to convert.
include_metadata (bool, optional) – If
True
is adds to FCS file meta data and.uns
of the AnnData object.
- Returns:
AnnData object.
- Return type:
- anndata_fcs.fcs_to_dataframe(fdata)#
Converts FlowData instance to pandas DataFrame.
- Parameters:
fdata (flowio.FlowData) – FlowData instance to convert.
- Returns:
Pandas dataframe.
- Return type:
- anndata_fcs.gate_polygon(fdata, x, y, polygon)#
Gate channel
x
andy
of FlowData instance with polygon.- Parameters:
fdata (flowio.FlowData) – FlowData instance to gate.
x (str) – Channel name for x coordinate.
y (str) – Channel name for y coordinate.
polygon (collections.abc.Sequence[collections.abc.Sequence[Union[int, float]]]) – Points of polygon with structure
[[x1, y1], [xn, yn], ...]
.
- Returns:
List of boolean with length of events per channel, where
True
indicated that point is inside the polygon.- Return type:
- anndata_fcs.gate_polygon_subset(fdata, x, y, polygon)#
Gating polygon on flow data object and returning subset.
- Parameters:
fdata (flowio.FlowData) – FlowData instance to gate.
x (str) – Channel name for x coordinate.
y (str) – Channel name for y coordinate.
polygon (collections.abc.Sequence[collections.abc.Sequence[Union[int, float]]]) – Points of polygon with structure
[[x1, y1], [xn, yn], ...]
.
- Returns:
Subset on
fdata
object, only containing events inside of polygon.- Return type:
- anndata_fcs.scatter(data, x, y, xscale='log', yscale='log', density=False, gates=None, gate_color='black', highlight=None, highlight_color='red', color='black', ax=None, figsize=(5, 5))#
Plot scatter from FCS data.
- Parameters:
data (Union[pandas.DataFrame, flowio.FlowData, anndata.AnnData]) – Event data. Argument can be DataFrame, AnnData or FlowData instance.
x (str) – Channel name for x coordinate.
y (str) – Channel name for y coordinate.
xscale (Literal["linear", "log", "symlog", "logit"], optional) – Scale of x axis. Defaults to
log
.yscale (Literal["linear", "log", "symlog", "logit"], optional) – Scale of y axis. Defaults to
log
.density (bool, optional) – Show denity as color. Defaults to
False
.scipy
is required for this option.gates (Optional[Dict[str, collections.abc[collections.abc[Union[int, float]]]]], optional) – Dict of gates, where the key indicated to name of the gate and the value describes to polygon. Defaults to
None
.gate_color (str, optional) – Color of gate. Defaults to
"black"
.highlight (Optional[List[bool]], optional) – List of events to highlight. Defaults to
None
.highlight_color (str, optional) – Color of events. Defaults to
"red"
,color (str) – Color of default event. Defaults to
"black"
.ax (Optional[matplotlib.axes.Axes], optional) – Matplotlib axes. Default to
None
.figsize (Tuple[int, int], optional) – Figure size. Defaults to
(5, 5)
.
- Returns:
Axes instance.
- Return type:
- Raises:
NotImplementedError – If
data
if other type than DataFrame, AnnData oder FlowData.ImportError – If
denity=True
andscipy
is not installed.AssertionError – If length of
highlight
does not match with length ofdata
.AssertionError – If x and y gate boundaries could not be calculated.