统一的细胞类型分析工具包,集成四个专业Agent提供完整的细胞类型注释流程
Project description
AgentType
统一的细胞类型分析工具包,集成四个专业 Agent 提供完整的细胞类型注释流程
核心特性
- 四大专业 Agent:MainAgent(主调度)、SubAgent(基因查询)、DataAgent(数据处理)、AppAgent(细胞注释)
- 多种注释算法:集成 SingleR、scType、CellTypist 等主流算法
- 灵活的数据格式:支持 RDS、H5AD、H5、CSV、JSON 等多种格式
- 国际化支持:内置中文和英文双语 Prompt 系统
- MCP 协议:基于 Model Context Protocol 的 Agent 间通信
- 完善的日志:统一的日志管理和结果输出系统
快速开始
安装
pip install agentype
基本使用
from agentype import annotate_cells
# 使用 AppAgent 进行细胞类型注释
result = await annotate_cells(
data_path="your_data.h5ad",
method="celltypist",
species="human"
)
命令行工具
# 启动所有 MCP 服务器
celltype-server
# 项目管理工具
celltype-manage status # 查看项目状态
celltype-manage config # 查看配置
celltype-manage examples # 运行示例
系统依赖
Python 环境
- Python 版本: ≥ 3.8
- 核心依赖: scanpy、pandas、numpy、fastapi 等(自动安装)
R 环境(AppAgent 注释功能需要)
AgentType 的部分细胞注释功能依赖 R 语言和相关 R 包:
安装 R(≥ 4.0)
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install -y r-base r-base-dev
macOS:
brew install r
Windows: 下载并安装:https://cran.r-project.org/bin/windows/base/
安装 R 包
启动 R 控制台并安装以下包:
# 安装 BiocManager
install.packages("BiocManager")
# 安装 SingleR(用于参考数据集注释)
BiocManager::install("SingleR")
# 安装其他依赖
install.packages(c("Seurat", "ggplot2", "dplyr"))
scType 数据库
scType 算法所需的数据库文件(ScTypeDB_full.xlsx)已内置在包中,无需额外下载。
CellTypist(可选)
如需使用 CellTypist 算法:
pip install celltypist
可选依赖
# 机器学习功能
pip install agentype[ml]
# 数据可视化
pip install agentype[viz]
# 性能优化
pip install agentype[performance]
# 完整安装
pip install agentype[annotation,ml,viz,performance]
配置
API 密钥设置
AgentType 使用 LLM 进行智能分析,需要配置 API 密钥:
export OPENAI_API_KEY="your-api-key-here"
export OPENAI_API_BASE="https://api.openai.com/v1" # 可选
export OPENAI_MODEL="gpt-4" # 可选
语言切换
# 使用中文 Prompts(默认)
export CELLTYPE_LANGUAGE=zh
# 使用英文 Prompts
export CELLTYPE_LANGUAGE=en
文档
四大 Agent 功能
MainAgent - 主调度器
统一工作流编排,协调其他 Agent,管理复杂分析流程。
from agentype import process_workflow
result = await process_workflow(
task="分析基因表达数据并注释细胞类型",
data_path="your_data.h5ad"
)
SubAgent - 基因查询服务
提供基因信息查询、细胞标记查询和富集分析。
from agentype import analyze_genes
result = await analyze_genes(
genes=["CD4", "CD8A", "CD3E"],
analysis_type="marker_search"
)
DataAgent - 数据处理专家
支持多种数据格式转换、质量控制和预处理。
from agentype import process_data
result = await process_data(
input_path="data.rds",
output_format="h5ad",
qc=True
)
AppAgent - 细胞注释工具
集成 SingleR、scType、CellTypist 等主流注释算法。
from agentype import annotate_cells
result = await annotate_cells(
data_path="your_data.h5ad",
method="singler",
reference="BlueprintEncodeData"
)
示例代码
项目包含丰富的示例代码,安装后可运行:
# 使用管理工具运行交互式示例
celltype-manage examples
# 或直接运行示例脚本
python -m agentype.examples.main_example
python -m agentype.examples.subagent_example
python -m agentype.examples.data_example
python -m agentype.examples.app_example
环境检查
安装后可使用以下命令检查环境配置:
from agentype import check_environment
# 检查 Python 依赖
check_environment(check_r=False)
# 检查 R 环境和 R 包
check_environment(check_r=True)
许可证
本项目采用 MIT 许可证 - 详见 LICENSE 文件。
支持与反馈
如遇到问题或有建议,请:
- 查看详细日志(默认位置:
outputs/logs/) - 检查配置文件(
~/.config/agentype/config.json或项目目录下的配置文件) - 参考 文档 目录中的详细说明
版本信息
当前版本:1.0.1
主要更新:
- 统一配置管理系统
- 集中式输出目录
- 标准化的 API 接口
- 完整的文档和示例
- 国际化支持(中英文)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentype-1.0.1.tar.gz.
File metadata
- Download URL: agentype-1.0.1.tar.gz
- Upload date:
- Size: 475.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab0be285df15b3f59e7a436be307fb8d8b71eca5f2d3dd0f2fea9429c26a7f54
|
|
| MD5 |
4d0350b07201d1e97c8d58928f2c8c7a
|
|
| BLAKE2b-256 |
0098760e39e713491a6b6f9661a1ec3ce009cfdbc42ca55f5e76060bf1797d7d
|
File details
Details for the file agentype-1.0.1-py3-none-any.whl.
File metadata
- Download URL: agentype-1.0.1-py3-none-any.whl
- Upload date:
- Size: 500.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8007cdf4cf2b28ad91d7c7ce6d8fcd2a15f9b56d0faa3147b991f67b665f5675
|
|
| MD5 |
a0d1250e68438e1ef1cfa9c07f1b645d
|
|
| BLAKE2b-256 |
133de415f792af85c58d292afd9e577392f8e707fdda9026380067d554956807
|