FACSPy.pl.transformation_plot

FACSPy.pl.transformation_plot#

FACSPy.pl.transformation_plot(adata, gate, marker, sample_identifier=None, scatter='SSC-A', sample_size=5000, figsize=(10, 3), return_dataframe=False, return_fig=False, show=True, save=None)#

Transformation plot. Plots the data on a log scale (biaxial), the data on the transformed scale (biaxial) and the data on a transformed scale as histogram.

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.

  • marker (str) – The channel to plot

  • sample_identifier (Optional[str]) – Used to specify a specific sample. Can be a valid sample_ID and a valid file_name from the .obs slot or the metadata

  • scatter (str) – The scatter channel to use on the y-axis. Defaults to SSC-A

  • sample_size (int) – Controls how many data points are displayed. Defaults to 5000. More displayed data points can significantly increase plotting time.

  • 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 – A Axes created 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.

Return type:

Optional[Figure, Axes, tuple[DataFrame, DataFrame, DataFrame, DataFrame, ndarray, ndarray, Optional[ndarray], Optional[ndarray]]]]

Returns:

  • If show==False a Axes

  • If return_fig==True a Figure

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

Examples

>>> import FACSPy as fp
>>> dataset
AnnData object with n_obs × n_vars = 615936 × 22
obs: 'sample_ID', 'file_name', 'condition', 'sex'
var: 'pns', 'png', 'pne', 'pnr', 'type', 'pnn'
uns: 'metadata', 'panel', 'workspace', 'gating_cols', 'dataset_status_hash'
obsm: 'gating'
layers: 'compensated', 'transformed'
>>> fp.pl.transformation_plot(
...     dataset,
...     gate = "live",
...     sample_identifier = "2", # plots sample_ID 2
...     marker = "CD3"
... )