본문으로 건너뛰기
Skillpedia
머신러닝5.4k · #14870

scgpt

하는 일

이 스킬은 단일 세포 생물학 데이터로 학습된 모델 scGPT를 사용해 세포 임베딩을 만들고 세포 유형에 라벨을 붙이는 방법을 에이전트에게 가르칩니다. 단일 세포 데이터셋을 다루는 생물학자와 데이터 과학자를 위한 것입니다.

사용하는 경우

  • ✓단일 세포 데이터셋의 세포를 묶거나 군집화하고 싶을 때.
  • ✓새로운 단일 세포 데이터셋의 세포 유형을 추정해야 하는 경우.
  • ✓섭동이나 네트워크 연구를 위해 유전자 수준의 표현이 필요할 때.

스킬 링크

https://github.com/aipoch/open-science/blob/main/resources/skills/scgpt/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/aipoch/open-science/blob/main/resources/skills/scgpt/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“scGPT로 제 단일 세포 데이터 파일의 세포 임베딩을 만들고, 세포 유형에 라벨을 붙여 줄 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

사용자는 세포별 유전자 개수가 담긴 AnnData 파일을 에이전트에게 줍니다. 모델은 각 세포를 숫자 집합으로 바꾸고, 이를 군집화와 라벨링에 쓸 수 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

scGPT — Single-Cell Foundation Model

Prerequisites

Requirement Minimum Recommended
Python 3.10+ 3.11
CUDA 12.1+ 12.4+
GPU VRAM 16 GB 24 GB+

How to run

Loading the vocabulary and checkpoint

scGPT checkpoints are raw directories (args.json, best_model.pt, vocab.json) — not Hugging Face hub repos. Point at the directory, not an HF repo id.

from scgpt.tokenizer.gene_tokenizer import GeneVocab
gv = GeneVocab.from_file("/path/to/scgpt-human/vocab.json")
print(len(gv))   # 60697 for the released human checkpoint

Embedding an AnnData

import anndata as ad
from scgpt.tasks import embed_data

adata = ad.read_h5ad("dataset.h5ad")        # var must contain a gene-name column
emb = embed_data(
    adata,
    model_dir="/path/to/scgpt-human",
    gene_col="feature_name",
    use_fast_transformer=False,             # see Gotchas
)
# emb is an AnnData with .obsm["X_scGPT"]

Output format

embed_data returns an AnnData whose .obsm["X_scGPT"] is the per-cell embedding (n_cells × emb_dim, 512 by default). Downstream: feed to scanpy.pp.neighbors / scanpy.tl.umap.

Remote compute

Needs ≥24 GB VRAM and the released human checkpoint (~200 MB: args.json, best_model.pt, vocab.json). Read compute_details({provider, mode:'read'}) for an environment with scgpt and a pre-cached checkpoint directory, then:

c = host.compute.create(provider)
job = c.submitJob(
    intent="scGPT embed 50k cells — 1×GPU, ~5 min",
    inputs=[
        {"src": "dataset.h5ad", "dstFilename": "dataset.h5ad"},
        {"src": "embed.py", "dstFilename": "embed.py"},
    ],
    command="python3 embed.py",
    environment=...,   # env name from compute_details
    outputs=["embedded.h5ad"],
    timeoutSeconds=1800,
)
print(job.job_id)   # cell ends here — kernel never blocks on compute

Retain the exact returned job_id. Query that saved ID with the non-blocking host.compute.create(provider).attachJob(job_id).status() or .result() when its state or result is relevant; do not scan Job history. A final .result() read reports whether its follow-up was suppressed or had already been committed; otherwise the app starts the later analysis turn for an unread final result. See the remote-compute-ssh skill for the orchestration details.

See the remote-compute-ssh / remote-compute-modal skill for the orchestration details.

In embed.py, pass model_dir= the checkpoint path from compute_details. If flash-attn is unavailable in that environment, set use_fast_transformer=False.

Gotchas

  • use_fast_transformer default is True but resolves to a FlashAttention path that may not import in every env. Pass use_fast_transformer=False unless you've confirmed flash_attn loads cleanly.
  • The package historically depended on torchtext.vocab.Vocab; in environments without torchtext a pure-Python shim provides Vocab — functionally identical for GeneVocab, but if you hit AttributeError: 'Vocab' object has no attribute …, you're on a stale shim.
  • Gene names must match the vocab; unmatched genes are dropped. Set gene_col to the column in adata.var that holds symbols.

Troubleshooting

Symptom Fix
flash_attn is not installed warning at import Harmless; pass use_fast_transformer=False
'Vocab' object has no attribute 'vocab' Env has an old torchtext shim — update the env
Nearly all genes dropped Wrong gene_col; check adata.var.columns
자주 묻는 질문

어떤 하드웨어가 필요한가요?

최소 16GB 메모리의 그래픽 카드가 필요하며, 24GB 이상을 권장합니다.

어떤 파일 형식을 쓰나요?

단일 세포 유전자 발현 데이터를 담는 AnnData 파일을 씁니다.

모델 다운로드는 얼마나 큰가요?

스킬은 공개된 사람용 체크포인트가 약 200MB라고 설명합니다.

상세 정보

작성자의 원본 설명

Embed and annotate single-cell expression data with scGPT, a foundation model for single-cell biology. Use this skill when: (1) Producing cell embeddings from an AnnData for clustering/integration, (2) Zero-shot or fine-tuned cell-type annotation, (3) Gene-level representation for perturbation/GRN tasks. For probabilistic single-cell models (scVI etc.), use the scvi-tools library.

repo: aipoch/open-science

인기도

GitHub 스타
5.4k
순위
#14870
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬