dynamo.tl.reduceDimension

dynamo.tl.reduceDimension(adata, X_data=None, genes=None, layer=None, basis='pca', dims=None, n_pca_components=30, n_components=2, n_neighbors=30, reduction_method='umap', embedding_key=None, neighbor_key=None, enforce=False, cores=1, copy=False, **kwargs)[source]

Compute a low dimension reduction projection of an annodata object first with PCA, followed by non-linear dimension reduction methods

Parameters
  • adata (AnnData) – an Annodata object

  • X_data (Optional[ndarray]) – The user supplied data that will be used for dimension reduction directly.

  • genes (Optional[list]) – The list of genes that will be used to subset the data for dimension reduction and clustering. If None, all genes will be used.

  • layer (Optional[str]) – The layer that will be used to retrieve data for dimension reduction and clustering. If None, .X is used.

  • basis (Optional[str]) – The space that will be used for clustering. Valid names includes, for example, pca, umap, velocity_pca (that is, you can use velocity for clustering), etc.

  • dims (Optional[list]) – The list of dimensions that will be selected for clustering. If None, all dimensions will be used.

  • n_pca_components (int) – Number of PCA components.

  • n_components (int) – The dimension of the space to embed into.

  • n_neighbors (int) – Number of nearest neighbors when constructing adjacency matrix.

  • reduction_method (str) – Non-linear dimension reduction method to further reduce dimension based on the top n_pca_components PCA components. Currently, PSL (probablistic structure learning, a new dimension reduction by us), tSNE (fitsne instead of traditional tSNE used) or umap are supported.

  • embedding_key (Optional[str]) – The str in .obsm that will be used as the key to save the reduced embedding space. By default it is None and embedding key is set as layer + reduction_method. If layer is None, it will be “X_neighbors”.

  • neighbor_key (Optional[str]) – The str in .uns that will be used as the key to save the nearest neighbor graph. By default it is None and neighbor_key key is set as layer + “_neighbors”. If layer is None, it will be “X_neighbors”.

  • cores (int) – Number of cores. Used only when the tSNE reduction_method is used.

Returns

adata – An new or updated anndata object, based on copy parameter, that are updated with reduced dimension data for data from different layers.

Return type

AnnData