FACSPy.pl.cluster_frequency#
- FACSPy.pl.cluster_frequency(adata, gate, cluster_key, cluster, normalize=False, groupby=None, splitby=None, cmap=None, order=None, stat_test='Kruskal', figsize=(3, 3), return_dataframe=False, return_fig=False, ax=None, show=True, save=None, **kwargs)#
Plots the cluster frequency per cluster as a combined strip-/boxplot.
- 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.cluster_key (
str) – The .obs column where the cluster information is stored.cluster (
str) – Specifies the cluster to be analyzed.normalize (
bool) – If True, normalizes the frequencies to the total amount of cells. If False, plots the cell counts per cluster and group.groupby (
Optional[Union`[:py:class:`list[str],str]]) – The parameter to group the x-axis.splitby (
Optional[str]) – The parameter controlling additional split along the groupby-axis.cmap (
Optional[str]) – Sets the colormap for plotting. Can be continuous or categorical, depending on the input data. When set, both seaborns ‘palette’ and ‘cmap’ parameters will use this value.order (
Optional[list[str]]) – specifies the order of x-values.stat_test (
str) – Statistical test that is used for the p-value calculation. One of Kruskal and Wilcoxon. Defaults to Kruskal.figsize (
tuple[float,float]) – Contains the dimensions of the final figure as a tuple of two ints or floats.return_dataframe (
bool) – If set to True, returns the raw data that are used for plotting as a dataframe.return_fig (
bool) – If set to True, the figure is returned.ax (
Optional[Axes]) – AAxescreated from matplotlib to plot into.show (
bool) – Whether to show the figure. Defaults to True.save (
Optional[str]) – Expects a file path including the file name. Saves the figure to the indicated path. Defaults to None.kwargs – keyword arguments ultimately passed to sns.stripplot.
- Return type:
Optional[Figure,Axes,DataFrame]]- Returns:
If show==False a
AxesIf return_fig==True a
FigureIf return_dataframe==True a
pandas.DataFramecontaing the data used for plotting
Examples
import FACSPy as fp dataset = fp.mouse_lineages() fp.settings.default_gate = "CD45+" fp.settings.default_layer = "transformed" fp.tl.pca(dataset) fp.tl.neighbors(dataset) fp.tl.leiden(dataset) fp.pl.cluster_frequency( dataset, cluster_key = "CD45+_transformed_leiden", cluster = "0", groupby = "organ" )