scviva.tools.vision.generate_projections#

scviva.tools.vision.generate_projections(adata, projection_methods=('tSNE30', 'tSNE10', 'UMAP', 'ISOMap', 'ICA', 'RBFPCA'), obsm_key='X_pca', K=None, projection_genes=None)[source]#

Generate 2D visualisation projections and store in adata.obsm.

Mirrors R VISION’s generateProjectionsInner. Dispatches each method to the appropriate input:

  • "ICA" — filtered log-transformed expression (cells × genes), not the latent space, to match R VISION’s behaviour.

  • "UMAP" — scanpy neighbour graph built on adata.obsm[obsm_key].

  • "tSNE30", "tSNE10", "ISOMap", "RBFPCA" — adata.obsm[obsm_key].

Results are stored in adata.obsm[f"X_{{method}}"] (e.g. "X_tSNE30", "X_UMAP", "X_RBFPCA").

Parameters:
adata AnnData

Annotated data matrix. Must have obsm_key in adata.obsm (produced by compute_latent_space()).

projection_methods Sequence[str]

Ordered list of projection names. Choose from "tSNE30", "tSNE10", "UMAP", "ISOMap", "ICA", "RBFPCA". Default: all six methods.

obsm_key str

Key in adata.obsm for the latent-space coordinates used by UMAP, tSNE, and ISOMap, by default "X_pca".

K int | None

Number of neighbours for UMAP and ISOMap. Defaults to round(sqrt(n_cells)).

projection_genes Sequence[str] | None

Subset of genes to use for the ICA projection. When None, all genes in adata.var_names are used.

Return type:

dict[str, ndarray]

Returns:

dict mapping str → ndarray of shape (n_cells, 2) Same mapping as the adata.obsm entries written by this function.

Raises:
  • KeyError – If obsm_key is not present in adata.obsm.

  • ValueError – If an unrecognised method name is requested.