pegasus.tsne

pegasus.tsne(data, rep='pca', n_jobs=- 1, n_components=2, perplexity=30, early_exaggeration=12, learning_rate='auto', initialization='pca', random_state=0, out_basis='tsne')[source]

Calculate t-SNE embedding of cells using the FIt-SNE package.

This function uses fitsne package. See [Linderman19] for details on FIt-SNE algorithm.

Parameters
  • data (pegasusio.MultimodalData) – Annotated data matrix with rows for cells and columns for genes.

  • rep (str, optional, default: "pca") – Representation of data used for the calculation. By default, use PCA coordinates. If None, use the count matrix data.X.

  • n_jobs (int, optional, default: -1) – Number of threads to use. If -1, use all physical CPU cores.

  • n_components (int, optional, default: 2) – Dimension of calculated FI-tSNE coordinates. By default, generate 2-dimensional data for 2D visualization.

  • perplexity (float, optional, default: 30) – The perplexity is related to the number of nearest neighbors used in other manifold learning algorithms. Larger datasets usually require a larger perplexity.

  • early_exaggeration (int, optional, default: 12) – Controls how tight natural clusters in the original space are in the embedded space, and how much space will be between them.

  • learning_rate (float, optional, default: auto) – By default, the learning rate is determined automatically as max(data.shape[0] / early_exaggeration, 200). See [Belkina19] and [Kobak19] for details.

  • initialization (str, optional, default: pca) – Initialization can be either pca or random or np.ndarray. By default, we use pca initialization according to [Kobak19].

  • random_state (int, optional, default: 0) – Random seed set for reproducing results.

  • out_basis (str, optional, default: "fitsne") – Key name for calculated FI-tSNE coordinates to store.

Return type

None

Returns

  • None

  • Update data.obsm

    • data.obsm['X_' + out_basis]: FI-tSNE coordinates of the data.

Examples

>>> pg.tsne(data)