ALLCools.clustering.art_of_tsne

ALLCools.clustering.art_of_tsne

The function art_of_tsne is from cytograph2 package https://github.com/linnarsson-lab/cytograph2/blob/master/cytograph/embedding/art_of_tsne.py

The idea behind that is based on [Kobak and Berens, 2019] with T-SNE algorithm implemented in [openTSNE](https://opentsne.readthedocs.io/en/latest/) [Poličar et al., 2019].

Module Contents

art_of_tsne(X: numpy.ndarray, metric: Union[str, Callable] = 'euclidean', exaggeration: float = - 1, perplexity: int = 30, n_jobs: int = - 1) openTSNE.TSNEEmbedding[source]

Implementation of Dmitry Kobak and Philipp Berens “The art of using t-SNE for single-cell transcriptomics” based on openTSNE. See https://doi.org/10.1038/s41467-019-13056-x | www.nature.com/naturecommunications

Parameters
  • X – The data matrix of shape (n_cells, n_genes) i.e. (n_samples, n_features)

  • metric – Any metric allowed by PyNNDescent (default: ‘euclidean’)

  • exaggeration – The exaggeration to use for the embedding

  • perplexity – The perplexity to use for the embedding

  • n_jobs – Number of CPUs to use

Returns

Return type

The embedding as an opentsne.TSNEEmbedding object (which can be cast to an np.ndarray)

tsne(adata, obsm='X_pca', metric: Union[str, Callable] = 'euclidean', exaggeration: float = - 1, perplexity: int = 30, n_jobs: int = - 1)[source]

Calculating T-SNE embedding with the openTSNE package [Poličar et al., 2019] and parameter optimization strategy described in [Kobak and Berens, 2019].

Parameters
  • adata – adata object with principle components or equivalent matrix stored in .obsm

  • obsm – name of the matrix in .obsm that can be used as T-SNE input

  • metric – Any metric allowed by PyNNDescent (default: ‘euclidean’)

  • exaggeration – The exaggeration to use for the embedding

  • perplexity – The perplexity to use for the embedding

  • n_jobs – Number of CPUs to use

Returns

Return type

T-SNE embedding will be stored at adata.obsm[“X_tsne”]