scDesign3Py.plot_reduceddim

scDesign3Py.plot_reduceddim(ref_anndata: anndata.AnnData, anndata_list: list | anndata.AnnData, name_list: list, color_by: str, assay_use: str | None = None, default_assay_name: str | None = None, n_pc: int = 50, pc_umap: bool = True, center: bool = True, scale: bool = True, if_plot: bool = True, shape_by: str | None = None, point_size: int | float = 1)[source]

Dimensionality reduction and visualization

Dimensionality reduction using both PCA and UMAP method. Based on your choice, return the plot or the dimension reduction result.

Details:

This function takes a reference anndata.AnnData and a list of new anndata.AnnData, performs the dimensionality reduction on the reference data, projects the synthetic datasets on the same low dimensional space, then visualize the results.

Arguments:

ref_anndata: anndata.AnnData

The reference anndata.AnnData

anndata_list: list or anndata.AnnData

anndata.AnnData which is synthetic. If there’s more than one synthetic result, combine them in a list.

name_list: list

A list of the names of each dataset. The length should be len(anndata_list)+1, where the first name is for ref_sce.

color_by: str

The name in the anndata.AnnData.obs used for color.

assay_use: str (default: None)

Indicates the assay you will use. If None, please specify a name for the assay stored in anndata.AnnData.X in @default_assay_name. The @assay_use is both used in @ref_anndata and @anndata_list.

default_assay_name: str (default: None)

Specified only when @assay_use is None. Asign a name to your default single cell experiment.

n_pc: int (default: 50)

The number of PCs.

pc_umap: bool (default: True)

Whether using PCs as the input of UMAP.

center: bool (default: True)

Whether centering the data before PCA.

scale: bool (default: True)

Whether scaling the data before PCA.

if_plot: bool (default: True)

Whether returning the plot. If False, return the reduced dimensions of each dataset.

shape_by: str (default: None)

The name in the anndata.AnnData.obs used for shape.

point_size: int or float (default: 1)

The point size in the final plot.

Output:

pandas.DataFrame or dict

When @if_plot is False, return the dataframe of reduced dimensions.

When @if_plot is True, return a dict with two plots generated by matplotlib.

p_pca:

PCA dimension reduction method

p_umap:

UMAP dimension reduction method