FACSPy.pl.sample_correlation#
- FACSPy.pl.sample_correlation(adata, gate, layer, metadata_annotation=None, include_technical_channels=False, exclude=None, data_group='sample_ID', data_metric='mfi', scaling='MinMaxScaler', corr_method='pearson', cmap='inferno', metaclusters=None, label_metaclusters_in_dataset=True, label_metaclusters_key='metacluster_sc', figsize=(4, 4), return_dataframe=False, return_fig=False, show=True, save=None)#
Plot for sample correlation.
- 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.layer (
str) – The layer corresponding to the data matrix. Similar to the gate parameter, it has a default stored in fp.settings which can be overwritten by user input.metadata_annotation (
Optional[Union`[:py:class:`list[str],str]]) – Controls the annotated variables on top of the plot.include_technical_channels (
bool) – Whether to include technical channels. If set to False, will exclude all channels that are not labeled with type==”fluo” in adata.var.exclude (
Optional[Union`[:py:class:`list[str],str]]) – Channels to be excluded from plotting.data_group (
str) – When MFIs/FOPs are calculated, and the groupby parameter is used, use data_group to specify the right dataframe.data_metric (
Literal['mfi','fop']) – One of mfi or fop. Using a different metric will calculate the asinh fold change on mfi and fop values, respectively.scaling (
Optional[Literal['MinMaxScaler','RobustScaler','StandardScaler']]) – Whether to apply scaling to the data for display. One of MinMaxScaler, RobustScaler or StandardScaler (Z-score). Defaults to MinMaxScaler.corr_method (
Literal['pearson','spearman','kendall']) – Correlation method that is used for correlation analysis. One of pearson, spearman or kendall. Defaults to pearson.cmap (
Optional[str]) – Sets the colormap for plotting the markers.metaclusters (
Optional[int]) – Controls the n of metaclusters to be computed.label_metaclusters_in_dataset (
bool) – Whether to label the calculated metaclusters and write into the metadata.label_metaclusters_key (
Optional[str]) – Column name that is used to store the metaclusters in.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.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.
- Return type:
Optional[ClusterGrid,DataFrame]]- Returns:
If show==False a
ClusterGridIf return_fig==True a
ClusterGridIf return_dataframe==True a
DataFramecontaining the data used for plotting
Examples
import FACSPy as fp dataset = fp.mouse_lineages() fp.tl.mfi(dataset, layer = "compensated") fp.pl.sample_correlation( dataset, gate = "CD45+", layer = "compensated", metadata_annotation = ["organ", "sex"] )