FACSPy.pl.marker_correlation

FACSPy.pl.marker_correlation#

FACSPy.pl.marker_correlation(adata, gate, layer, include_technical_channels=False, exclude=None, scaling='MinMaxScaler', data_group='sample_ID', data_metric='mfi', corr_method='pearson', cmap='inferno', y_label_fontsize=10, figsize=(4, 4), return_dataframe=False, return_fig=False, show=True, save=None)#

Plot for marker correlation heatmap.

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

  • gate (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.

  • 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.

  • scaling (Literal['MinMaxScaler', 'RobustScaler', 'StandardScaler']) – Whether to apply scaling to the data for display. One of MinMaxScaler, RobustScaler or StandardScaler (Z-score).

  • 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

  • corr_method (Literal['pearson', 'spearman', 'kendall']) – correlation method that is used. One of pearson, spearman or kendall.

  • cmap (str) – Sets the colormap for plotting the markers.

  • y_label_fontsize (float) – controls the fontsize of the marker labels.

  • 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 ClusterGrid

  • If return_fig==True a ClusterGrid

  • If return_dataframe==True a DataFrame containing the data used for plotting

Examples

import FACSPy as fp

dataset = fp.mouse_lineages()

fp.tl.mfi(dataset, layer = "compensated")

fp.pl.marker_correlation(
    dataset,
    gate = "CD45+",
    layer = "compensated"
)
../_images/FACSPy-pl-marker_correlation-1.png