scvi-tools
यह क्या करती है
यह स्किल scvi-tools से सिंगल-सेल RNA डेटा साफ़ करने और उसका विश्लेषण करने का तरीका सिखाती है, जिसमें batch effects हटाना भी शामिल है। यह अलग-अलग बैच के डेटासेट जोड़ने वाले जीव-वैज्ञानिकों और डेटा वैज्ञानिकों के लिए है।
कब इस्तेमाल करें
- ✓जब आपको अलग-अलग बैच के सिंगल-सेल डेटासेट को बिना batch effect के जोड़ना है।
- ✓जब आप किसी संदर्भ डेटासेट से नए डेटासेट में सेल-प्रकार के लेबल लाना चाहते हैं।
- ✓जब आपको क्लस्टर्स के बीच अलग दिखने वाले जीन खोजने हैं।
Skill का लिंक
https://github.com/aipoch/open-science/blob/main/resources/skills/scvi-tools/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इन तीन सिंगल-सेल बैच को जोड़िए, batch effect हटाइए, और हर क्लस्टर के शीर्ष जीन खोजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट आपका कच्चा काउंट डेटा जाँचता है, एक probabilistic मॉडल प्रशिक्षित करता है, और एक कम-आयामी स्पेस लौटाता है जिसे आप आम सिंगल-सेल टूल्स से क्लस्टर और विज़ुअलाइज़ कर सकते हैं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
scvi-tools — scVI / scANVI
scvi-tools (Gayoso et al. 2022, github.com/scverse/scvi-tools, BSD-3-Clause)
wraps a family
of deep generative models for single-cell omics. The scRNA-seq core is scVI
(unsupervised batch-corrected latent embedding) and scANVI (scVI + a
classifier head for semi-supervised cell-type label transfer). Both expect
raw integer UMI counts and emit a low-dimensional X_scVI / X_scANVI
that drops into the scanpy neighbors → leiden → umap pipeline.
Setup (any agent, no API key)
This is a pure skill — kernel.py is deterministic Python and you (the
base model) do all the reasoning. There is no host runtime and no LLM API.
The helpers are prepare_scvi_counts for input validation and h5ad_safe_obs
for obs/var frames that anndata.write_h5ad() can serialize. Load them once
per session in a Python cell:
exec(open("scvi-tools/kernel.py", encoding="utf-8").read()) # path to this skill's kernel.py
Nothing auto-loads it outside Claude Science. Then call the helpers directly.
If a helper raises NameError, you haven't exec'd kernel.py.
Dependencies: pip install scvi-tools scanpy anndata. Training needs a
CUDA-capable GPU — see Remote compute to fall out
to a rented GPU when you don't have one locally.
How to run
scVI — batch-corrected latent space
prepare_scvi_counts(adata) checks and preserves existing counts. If absent,
it checks .X before copying it to counts. Values must be finite, nonnegative,
and integer-valued, with at least one positive count. Invalid existing counts
raise instead of being replaced by .X; sparse matrices stay sparse.
These numerical checks cannot prove raw-count provenance. Check the dataset
documentation or preprocessing history; do not round or exponentiate transformed
values to make them pass. If the history is unclear, resolve it before training.
The helper does not use .raw.X, which may be normalized or have a different
gene axis. Use an in-memory AnnData object; materialize backed data or copy views
only within the available memory budget.
import scanpy as sc
import scvi
adata = sc.read_h5ad("dataset.h5ad")
# Verify count provenance from the input documentation or preprocessing history.
# Preserve counts if present; otherwise validate .X before copying it to counts.
counts_record = prepare_scvi_counts(adata)
print(counts_record) # numerical checks only; does not certify provenance
adata.X = adata.layers["counts"].copy() # derive plotting/HVG data from verified counts
sc.pp.normalize_total(adata); sc.pp.log1p(adata) # optional, for HVG / plotting only
sc.pp.highly_variable_genes(adata, n_top_genes=2000, batch_key="batch", subset=True)
scvi.model.SCVI.setup_anndata(adata, layer="counts", batch_key="batch")
model = scvi.model.SCVI(adata, n_latent=30)
model.train(max_epochs=200, early_stopping=True, accelerator="gpu", devices=1)
adata.obsm["X_scVI"] = model.get_latent_representation()
adata.layers["scvi_normalized"] = model.get_normalized_expression(library_size=1e4)
scANVI — label transfer from a partially-annotated reference
lvae = scvi.model.SCANVI.from_scvi_model(
model, labels_key="cell_type", unlabeled_category="Unknown",
)
lvae.train(max_epochs=20, n_samples_per_label=100, accelerator="gpu", devices=1)
adata.obsm["X_scANVI"] = lvae.get_latent_representation()
adata.obs["pred_cell_type"] = lvae.predict()
accelerator="gpu", devices=1 is the PyTorch-Lightning spelling; the legacy
use_gpu= kwarg was removed in scvi-tools 1.x and now raises TypeError.
Differential expression
de = model.differential_expression(
groupby="leiden", group1="3", # group2=None → vs. all other cells
mode="change", delta=0.25,
)
top = de.sort_values("proba_de", ascending=False).head(50)
For one-vs-rest leave group2 out — "rest" is scanpy's
rank_genes_groups convention, not scvi-tools'; here group2 is a literal
category name and "rest" would match zero cells.
scvi-tools ≥1.4 defaults to mode="vanilla", whose result columns are
exactly:
['proba_m1', 'proba_m2', 'bayes_factor', 'scale1', 'scale2', 'raw_mean1',
'raw_mean2', 'non_zeros_proportion1', 'non_zeros_proportion2',
'raw_normalized_mean1', 'raw_normalized_mean2', 'comparison', 'group1',
'group2']
— no lfc_*, no proba_de, no is_de_fdr_*. Pass mode="change" to
get lfc_mean / lfc_median / proba_de / `is_de_f
अक्सर पूछे जाने वाले सवाल
इसे किस तरह का डेटा चाहिए?
स्किल के अनुसार इसे सामान्यीकृत मान नहीं, बल्कि कच्चे पूर्णांक UMI काउंट चाहिए।
क्या इसे ग्राफ़िक्स कार्ड चाहिए?
प्रशिक्षण के लिए CUDA-सक्षम GPU चाहिए। स्किल यह भी बताती है कि GPU न हो तो उसे किराए पर कैसे लें।
कौन-सा सॉफ़्टवेयर इंस्टॉल होना चाहिए?
स्किल scvi-tools, scanpy और anndata इस्तेमाल करती है, जो pip से इंस्टॉल होते हैं।
जानकारी
लेखक का मूल विवरण
Probabilistic single-cell RNA-seq with scvi-tools — scVI for a batch-corrected latent space, scANVI for semi-supervised label transfer, and Bayesian differential expression. Reach for this skill to integrate scRNA-seq batches, embed cells for clustering, transfer annotations from a reference onto a query, or score differentially expressed genes per cluster. For spatial deconvolution / mapping use the cell2location, DestVI, or Tangram methods instead.
repo: aipoch/open-science
लोकप्रियता
- GitHub स्टार
- 5.4k
- रैंकिंग में स्थान
- #14871
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
alphafold2
5.4kयह आपके एजेंट को ColabFold रनर के ज़रिए AlphaFold2 से प्रोटीन की 3D संरचना उसके सीक्वेंस से अनुमानित करने देती है, प्रोटीन कॉम्प्लेक्स सहित।
boltz
5.4kयह आपके एजेंट को Boltz-2 मॉडल से प्रोटीन, DNA, RNA और छोटे अणुओं के कॉम्प्लेक्स अनुमानित करने देती है, वैकल्पिक बाइंडिंग एफ़िनिटी के साथ।
borzoi
5.4kयह आपके एजेंट को DNA सीक्वेंस से जीनोम-व्यापी गतिविधि ट्रैक, जैसे एक्सप्रेशन और एक्सेसिबिलिटी, अनुमानित करने देती है, और वेरिएंट की अनुमानित असर से तुलना करने देती है।
chai1
5.4kयह आपके एजेंट को एक FASTA फ़ाइल से Apache लाइसेंस वाले Chai-1 मॉडल के साथ प्रोटीन, न्यूक्लिक एसिड और लिगैंड कॉम्प्लेक्स की संरचना अनुमानित करने देती है।
मिलती-जुलती skills
pytorch-patterns
280kआपके एजेंट को machine learning models के लिए PyTorch इस्तेमाल करने में मदद करता है। कुशल model training के best practices लागू करता है और नतीजों को दोहराने लायक रखता है।
evm-token-decimals
280kयह आपके एजेंट को अलग-अलग blockchain networks पर decimal numbers की गलतियों से बचने में मदद करता है। यह transactions और calculations में token values सही रखने का ध्यान रखता है।
ito-inference
280kआपके एजेंट को AI models की उपलब्धता जाँचने देता है। यह compute request को तैयार model service से जोड़ता है।