Foundation Model Analysis 标志

Foundation Model Analysis

组织
omicverse
foundation-model-analysis

Foundation model workflows: scGPT, Geneformer, UCE, CellPLM cell embedding, annotation, integration via ov.fm unified API. 22 models.

概览

发布者omicverse
代码仓库omicclaw
技能名称foundation-model-analysis
星标数
33
复刻数
5
附带文件
1
许可协议GPL-3.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 1 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 omicverse 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Foundation Model Analysis AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/omicverse/omicclaw/tree/main/src/omicverse_skills/skills/fm-foundation-models
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/omicverse/omicclaw.git /tmp/omicclaw
mkdir -p .claude/skills
cp -r /tmp/omicclaw/src/omicverse_skills/skills/fm-foundation-models .claude/skills/foundation-model-analysis
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Foundation Model Analysis,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Foundation Model Analysis。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Foundation Model Analysis 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Foundation Model Analysis

Use this skill when a user wants to generate cell embeddings, annotate cell types, integrate batches, or predict perturbation effects using single-cell foundation models. The ov.fm module provides a unified 6-step API that works identically across all 22 supported models.

Model Selection Guide

Pick a model based on your task, species, and hardware. The 5 skill-ready models have full adapter support:

ModelTasksSpeciesGene IDsMin VRAMCPU?Best when
scGPTembed, integratehuman, mousesymbol8 GBYesGeneral RNA, multi-modal (RNA+ATAC+Spatial)
Geneformerembed, integratehumanensembl4 GBYesEnsembl IDs, CPU-only environments, network biology
UCEembed, integrate7 speciessymbol16 GBNoCross-species (zebrafish, macaque, pig, frog, lemur)
scFoundationembed, integratehumancustom16 GBNoxTrimoGene architecture, perturbation tasks
CellPLMembed, integratehumansymbol8 GBYesFastest inference (batch_size=128), cell-centric

12 additional partial models (scBERT, GeneCompass, Nicheformer, scMulan, tGPT, CellFM, scCello, scPrint, AiDocell, Pulsar, Atacformer, scPlantLLM) and 5+ experimental models are also registered.

Quick decision tree

  • Cross-species → UCE
  • Ensembl gene IDs or CPU-only → Geneformer
  • ATAC-seq data → Atacformer (partial) or scGPT
  • Multi-omics (RNA+ATAC+Protein) → scMulan (partial)
  • Spatial transcriptomics → Nicheformer (partial) or scGPT
  • Fastest throughput on large datasets → CellPLM
  • General RNA, no special needs → scGPT

6-Step Unified Workflow

Every FM analysis follows the same pipeline regardless of model choice:

Step 1: Discover available models

python
import omicverse as ov
models = ov.fm.list_models(task="embed", skill_ready_only=True)
# Returns: {"count": int, "models": [{name, version, tasks, species, ...}]}

Step 2: Profile your data

python
profile = ov.fm.profile_data("pbmc3k.h5ad")
# Auto-detects: species, gene_scheme (symbol/ensembl), modality, batch/celltype columns
# Returns model_compatibility per model (compatible: bool, issues: [], recommendations: [])

Step 3: Select best model

python
selection = ov.fm.select_model(
    "pbmc3k.h5ad",
    task="embed",
    prefer_zero_shot=True,   # No labeled data needed
    max_vram_gb=8,            # Hardware constraint
)
model_name = selection['recommended']['name']
# Returns: recommended model with rationale, fallbacks list, preprocessing_notes

Step 4: Validate compatibility

python
validation = ov.fm.preprocess_validate("pbmc3k.h5ad", model_name, "embed")
# Returns: status ("ready"/"needs_preprocessing"), diagnostics, auto_fixes suggestions

Step 5: Execute

python
result = ov.fm.run(
    task="embed",
    model_name=model_name,
    adata_path="pbmc3k.h5ad",
    output_path="pbmc3k_embedded.h5ad",
    device="auto",          # auto-detects cuda/mps/cpu
    batch_size=64,          # CellPLM can use 128
    batch_key=None,         # For integration tasks
    label_key=None,         # For annotation tasks
    checkpoint_dir=None,    # Auto-resolved from env vars or cache
)
# Returns: {output_path, output_keys, statistics} or {error: str}

Step 6: Interpret results

python
metrics = ov.fm.interpret_results(
    "pbmc3k_embedded.h5ad",
    task="embed",
    generate_umap=True,
    color_by=["cell_type"],
)
# Returns: metrics (silhouette scores), visualizations, embedding_keys

Gene ID Resolution

Gene ID mismatch is the most common failure mode. The profile_data() function detects your data's gene scheme automatically.

ModelExpected IDsExampleAuto-convert?
scGPTHGNC symbolsTP53, CD4No — data must use symbols
GeneformerEnsembl IDsENSG00000141510No — data must use Ensembl
UCEHGNC symbolsTP53, CD4No
scFoundationCustom vocab19,264 gene vocabAdapter handles mapping

If profile_data() reports gene_scheme: "ensembl" but you selected scGPT (which needs symbols), either convert gene IDs first or switch to Geneformer.

Hardware Requirements

ModelGPU RequiredMin VRAMCPU FallbackDefault Batch Size
scGPTRecommended8 GBYes (slow)64
GeneformerNo4 GBYes (full speed)64
UCEYes16 GBNo64
scFoundationYes16 GBNo64
CellPLMRecommended8 GBYes128

Device auto-detection priority: CUDA → MPS (Apple Silicon) → CPU.

Checkpoint resolution priority:

  1. checkpoint_dir parameter in ov.fm.run()
  2. Model-specific env var: OV_FM_CHECKPOINT_DIR_SCGPT
  3. Base env var + subfolder: OV_FM_CHECKPOINT_DIR/scgpt/
  4. OmicVerse model cache (auto-download if available)

Critical API Reference

TaskType values

"embed", "annotate", "integrate", "perturb", "spatial", "drug_response"

Output keys are model-specific

python
# After running, embeddings are stored in adata.obsm with model-specific keys:
# scGPT → adata.obsm['X_scGPT']
# Geneformer → adata.obsm['X_geneformer']
# UCE → adata.obsm['X_uce']
# Check result['output_keys'] for the exact keys written

Provenance tracking

python
# Every run writes provenance to adata.uns['fm']:
# {"runs_json": [...], "latest_json": "..."}
# Contains: model_name, version, task, timestamp, output_keys

Defensive Validation Patterns

python
import os

# Before any FM workflow: verify input file exists
assert os.path.isfile(adata_path), f"Input file not found: {adata_path}"

# After profile_data: check species was detected
profile = ov.fm.profile_data(adata_path)
assert 'unknown' not in profile.get('species', 'unknown').lower(), \
    f"Species not detected. Check gene names — use HGNC symbols (human) or standard names (mouse)."

# After select_model: verify a model was recommended
selection = ov.fm.select_model(adata_path, task="embed")
assert 'recommended' in selection and selection['recommended'], \
    "No compatible model found. Check species, gene IDs, and hardware constraints."

# Before run: verify checkpoint exists (for models requiring local weights)
desc = ov.fm.describe_model(model_name)
if desc.get('resources', {}).get('checkpoint_url'):
    print(f"Model may need checkpoint download. Check OV_FM_CHECKPOINT_DIR env var.")

Troubleshooting

  • Gene ID mismatch warning in profile: Your data uses Ensembl IDs but the selected model expects symbols (or vice versa). Convert with adata.var_names = adata.var['gene_symbols'] or switch to a compatible model.
  • CUDA out of memory: Reduce batch_size (try 32 or 16). For UCE/scFoundation (16GB VRAM), ensure no other GPU processes are running.
  • Model not installed or ImportError: Some models need separate packages. Install via pip install scgpt / pip install geneformer or use conda isolation (OV_FM_DISABLE_CONDA_SUBPROCESS=0).
  • Species unsupported: Most models only support human. For mouse, use scGPT or UCE. For zebrafish/pig/frog, only UCE works.
  • Empty embeddings (all zeros): Input data may have constant or near-zero expression. Filter genes with sc.pp.filter_genes(adata, min_cells=10) before running.
  • Checkpoint not found: Set the environment variable OV_FM_CHECKPOINT_DIR_<MODEL>=/path/to/weights or pass checkpoint_dir directly to ov.fm.run().
  • device='auto' picks CPU despite GPU available: Check torch.cuda.is_available(). If False, verify CUDA drivers and PyTorch CUDA build.

Examples

  • "Generate scGPT embeddings for my PBMC dataset and visualize on UMAP."
  • "Which foundation model works best for my mouse brain scRNA-seq data?"
  • "Embed my ATAC-seq data using a foundation model — I only have 8GB VRAM."
  • "Profile my h5ad file and tell me which models are compatible."

References

  • Quick copy/paste commands: reference.md
  • FM API source: omicverse/fm/api.py
  • Model registry: omicverse/fm/registry.py

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Foundation Model Analysis AI 技能有什么作用?

Foundation model workflows: scGPT, Geneformer, UCE, CellPLM cell embedding, annotation, integration via ov.fm unified API. 22 models.

为什么在 TypingMind 中使用 Foundation Model Analysis?

因为您只需安装一次,就能搭配任何模型使用。Foundation Model Analysis 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Foundation Model Analysis?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/omicverse/omicclaw/tree/main/src/omicverse_skills/skills/fm-foundation-models。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Foundation Model Analysis?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Foundation Model Analysis 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Foundation Model Analysis 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Foundation Model Analysis AI 技能免费吗?

是的。omicverse 已在 GitHub 上根据 GPL-3.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇