tfmindi.pl.tsne#
- tfmindi.pl.tsne(adata, color_by='leiden', alpha=0.2, s=2, show_legend=True, cmap='tab20', **kwargs)#
Visualize seqlet clusters in t-SNE space as a scatter plot.
Fast, lightweight function for data exploration without sequence logos. Ideal for quickly examining cluster structure and testing different coloring schemes.
- Parameters:
adata (
AnnData) – AnnData object with t-SNE coordinates and cluster assignments. Must contain adata.obsm[“X_tsne”] and adata.obs[“leiden”].color_by (
str(default:'leiden')) – Column in adata.obs to use for coloring points (default: “leiden”).alpha (
float(default:0.2)) – Transparency of scatter points.s (
float(default:2)) – Size of scatter points.show_legend (
bool(default:True)) – Whether to show the legend (default: True).cmap (
str(default:'tab20')) – Colormap name for categorical data (default: “tab20”). Any valid matplotlib colormap name (e.g., “viridis”, “plasma”, “Set1”).**kwargs – Additional arguments passed to render_plot() for styling and display options. Common options include width, height, title, xlabel, ylabel, show, save_path.
- Return type:
- Returns:
matplotlib.Figure or None Figure with t-SNE scatter plot, or None if show=True.
Examples
>>> import tfmindi as tm >>> # Basic t-SNE plot colored by clusters >>> fig = tm.pl.tsne(adata, color_by="leiden") >>> # Color by DNA-binding domain annotations >>> tm.pl.tsne(adata, color_by="cluster_dbd", width=8, height=6) >>> # Custom styling >>> tm.pl.tsne(adata, color_by="leiden", alpha=0.8, s=30, title="Seqlet Clusters", show_legend=False)