The Explainability Problem in scRNA-seq
Single-cell RNA-seq analysis increasingly relies on deep learning — scVI for batch correction, CellTypist for annotation, scVelo for trajectory inference. These models work well, but they're black boxes. When your AI agent clusters 50,000 cells into 15 types, can you explain why a cell was assigned to cluster 7?
For publishable research, "the model said so" isn't enough. Reviewers want to know which genes drove the classification, whether batch effects contaminated the embedding, and how confident the annotation really is.
This guide covers the tools and skills that bring explainability to scRNA-seq AI workflows.
What "Explainable" Means for scRNA-seq
Explainability in single-cell analysis has three layers:
- Feature attribution — Which genes matter most for a given prediction? (SHAP values, attention weights)
- Confidence scoring — How certain is the model about this cell type label? (posterior probabilities, entropy)
- Latent space interpretability — What do the dimensions in the scVI/scANVI embedding actually represent?
Most existing scRNA-seq pipelines handle none of these. Here's how to add them.
Tool 1: SHAP for Gene Importance
What it does: SHAP (SHapley Additive exPlanations) assigns each gene an importance score for every prediction — not just globally, but per cell.
Why it matters for scRNA-seq: Instead of "this cell is a T-cell," you get "this cell is a T-cell because CD3D, CD3E, and IL7R are highly expressed, and CD19 is absent."
How to use it:
import shap
import scanpy as sc
# After clustering with scanpy
# Train a classifier on your clusters
from sklearn.ensemble import GradientBoostingClassifier
clf = GradientBoostingClassifier()
clf.fit(adata.X, adata.obs['leiden'])
# Explain with SHAP
explainer = shap.TreeExplainer(clf)
shap_values = explainer.shap_values(adata.X)
# Visualize top genes driving cluster assignment
shap.summary_plot(shap_values, adata.X, feature_names=adata.var_names)OpenClaw Skill: Install shap from K-Dense Scientific Skills:
clawhub install shapTool 2: scVI with Posterior Analysis
What it does: scVI provides a probabilistic latent space — meaning every cell embedding comes with uncertainty estimates, not just point coordinates.
Why it matters: You can quantify how "confident" the model is about placing a cell in a particular region of the UMAP. High uncertainty = the cell might be transitional or poorly characterized.
How to access uncertainty:
import scvi
# After training scVI model
posterior = model.get_latent_representation(give_mean=False)
# posterior shape: (n_samples, n_cells, n_latent)
# Variance across samples = uncertainty per cell
import numpy as np
uncertainty = np.var(posterior, axis=0).mean(axis=1)
adata.obs['embedding_uncertainty'] = uncertainty
# High uncertainty cells are candidates for manual reviewOpenClaw Skill: scvi-tools from K-Dense or FreedomIntelligence:
clawhub install scvi-toolsTool 3: CellTypist Confidence Scores
What it does: CellTypist doesn't just assign labels — it provides probability scores for every possible cell type per cell.
Why it matters: A cell labeled "CD8 T-cell" with 95% confidence is very different from one labeled with 51% confidence. The latter might be a transitional state or annotation error.
How to extract confidence:
import celltypist
# Run prediction
predictions = celltypist.annotate(adata, model='Immune_All_Low.pkl')
# Access probability matrix
prob_matrix = predictions.probability_matrix
# Shape: (n_cells, n_cell_types)
# Flag low-confidence annotations
adata.obs['annotation_confidence'] = prob_matrix.max(axis=1)
low_conf = adata.obs['annotation_confidence'] < 0.7
print(f"{low_conf.sum()} cells with <70% confidence")OpenClaw Skill: bio-single-cell-cell-annotation from FreedomIntelligence:
clawhub install bio-single-cell-cell-annotationTool 4: UMAP Trustworthiness Metrics
What it does: UMAP is great for visualization but can create misleading clusters. Trustworthiness metrics quantify how much you should trust the 2D layout.
Key metrics:
- Trustworthiness score — Are nearby points in UMAP also nearby in high-dimensional space?
- Continuity score — Are nearby points in high-dimensional space also nearby in UMAP?
- Silhouette score — How well-separated are the clusters?
from sklearn.metrics import silhouette_score
from sklearn.manifold import trustworthiness
# Trustworthiness of UMAP embedding
trust = trustworthiness(adata.obsm['X_pca'], adata.obsm['X_umap'], n_neighbors=15)
print(f"UMAP trustworthiness: {trust:.3f}") # >0.95 is good
# Silhouette score for clusters
sil = silhouette_score(adata.obsm['X_umap'], adata.obs['leiden'])
print(f"Cluster separation: {sil:.3f}") # >0.3 is reasonableTool 5: GRN Inference for Mechanistic Explanation
What it does: Gene Regulatory Network inference (via GRNBoost2/GENIE3) identifies which transcription factors regulate which target genes — providing a mechanistic explanation for cell state differences.
Why it matters: Instead of "cluster 5 has high expression of these 50 genes," you get "cluster 5 is driven by transcription factor FOXP3, which activates these downstream targets" — a biologically interpretable explanation.
OpenClaw Skill: arboreto from K-Dense:
clawhub install arboretoPutting It All Together: An Explainable scRNA-seq Pipeline
1. QC & preprocessing ──→ scrna-orchestrator (ClawBio)
2. Batch correction ────→ scvi-tools (probabilistic, with uncertainty)
3. Clustering ──────────→ scanpy (Leiden)
4. Annotation ──────────→ CellTypist (with confidence scores)
5. Explanation ─────────→ SHAP (gene importance per cluster)
6. Validation ──────────→ UMAP trustworthiness + silhouette
7. Mechanism ───────────→ arboreto (GRN inference)Each step produces interpretable output. No black boxes.
Which Skills to Install
| Step | Skill | Hub | Install |
|---|---|---|---|
| End-to-end pipeline | scrna-orchestrator | ClawBio | clawhub install scrna-orchestrator |
| Batch correction | scvi-tools | K-Dense | clawhub install scvi-tools |
| Cell annotation | bio-single-cell-cell-annotation | FreedomIntelligence | clawhub install bio-single-cell-cell-annotation |
| Gene importance | shap | K-Dense | clawhub install shap |
| GRN inference | arboreto | K-Dense | clawhub install arboreto |
| Trajectory | scvelo | K-Dense | clawhub install scvelo |
Why This Matters for Publication
Journals increasingly require interpretability:
- Nature Methods editorial (2025): "Authors should report confidence metrics for automated cell type annotations"
- Genome Biology reviewer guidelines now include "explain model decisions for key biological claims"
- STAR Methods sections are expected to address reproducibility and interpretability
An explainable pipeline isn't just good practice — it's becoming a publication requirement.
Related Resources
- scRNA-seq Skills Guide →
- Spatial Transcriptomics with AI →
- Curated Skills for Researchers →
- Red Ocean vs Blue Ocean of Skills →
Last updated: March 27, 2026. All skills are actively maintained and free to install.
