scFoundation¶
✅ Status: ready | Version: xTrimoGene
Overview¶
Large-scale asymmetric transformer (xTrimoGene), custom 19264 gene vocabulary, pre-trained for perturbation/drug response
!!! tip “When to choose scFoundation”
User needs perturbation prediction, drug response modeling, or works with the xTrimoGene gene vocabulary
Specifications¶
Property |
Value |
|---|---|
Model |
scFoundation |
Version |
xTrimoGene |
Tasks |
|
Modalities |
RNA |
Species |
human |
Gene IDs |
custom (19,264 gene set) |
Embedding Dim |
512 |
GPU Required |
Yes |
Min VRAM |
16 GB |
Recommended VRAM |
32 GB |
CPU Fallback |
No |
Adapter Status |
✅ ready |
Quick Start¶
import omicverse as ov
# 1. Check model spec
info = ov.fm.describe_model("scfoundation")
# 2. Profile your data
profile = ov.fm.profile_data("your_data.h5ad")
# 3. Validate compatibility
check = ov.fm.preprocess_validate("your_data.h5ad", "scfoundation", "embed")
# 4. Run inference
result = ov.fm.run(
task="embed",
model_name="scfoundation",
adata_path="your_data.h5ad",
output_path="output_scfoundation.h5ad",
device="auto",
)
# 5. Interpret results
metrics = ov.fm.interpret_results("output_scfoundation.h5ad", task="embed")
Input Requirements¶
Requirement |
Detail |
|---|---|
Gene ID scheme |
custom (19,264 gene set) |
Preprocessing |
Match genes to model vocabulary. Follow xTrimoGene preprocessing pipeline. |
Data format |
AnnData ( |
Batch key |
|
Output Keys¶
After running ov.fm.run(), results are stored in the AnnData object:
Key |
Location |
Description |
|---|---|---|
|
|
Cell embeddings (512-dim) |
|
|
Predicted cell type labels |
import scanpy as sc
adata = sc.read_h5ad("output_scfoundation.h5ad")
embeddings = adata.obsm["X_scfoundation"] # shape: (n_cells, 512)
# Downstream analysis
sc.pp.neighbors(adata, use_rep="X_scfoundation")
sc.tl.umap(adata)
sc.tl.leiden(adata, resolution=0.5)
sc.pl.umap(adata, color=["leiden"])
Resources¶
Repository / Checkpoint: https://github.com/biomap-research/scFoundation
License: Check upstream LICENSE
Hands-On Tutorial¶
For a step-by-step walkthrough with code, see the scFoundation Tutorial Notebook.