scviva.tools.vision.apply_tsne

Contents

scviva.tools.vision.apply_tsne#

scviva.tools.vision.apply_tsne(X, perplexity=30.0, n_iter=800)[source]#

t-SNE 2D projection via sklearn.

Mirrors R VISION’s applytSNE10 / applytSNE30. Input is expected to be the latent-space coordinates (PCA scores), matching R’s behaviour of passing t(latentSpace) to Rtsne with pca=FALSE.

Parameters:
  • X (ndarray of shape (n_cells, n_dims)) – Latent-space cell coordinates.

  • perplexity (float, optional) – t-SNE perplexity, by default 30.0. Use 10.0 for the "tSNE10" variant.

  • n_iter (int, optional) – Maximum number of optimisation iterations, by default 800 (matches R’s max_iter=800).

Returns:

2D t-SNE coordinates.

Return type:

ndarray of shape (n_cells, 2)