蛋白质适应度建模工具

一个基于ProtTrans语言模型的蛋白质适应度预测工具,提供序列嵌入提取、突变评分、回归模型训练和适应度预测功能。

  • by MacromNex
  • Jupyter Notebook
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 Biomolecular-Design-Nexus/prottrans_mcp

使用说明

ProtTrans MCP

通过Docker使用ProtTrans语言模型进行蛋白质适应度建模

用于蛋白质适应度预测的MCP(模型上下文协议)服务器,具有4个核心工具:

  • 从蛋白质序列中提取ProtTrans包埋物
  • 计算突变的ProtBERT对数似然评分
  • 使用5倍交叉验证训练回归适应度模型
  • 使用训练好的模型预测新蛋白质序列的适用性

Docker快速入门

方法1:从GitHub中提取预构建映像

最快的开始方式。每次发布时,预构建的Docker镜像都会自动发布到GitHub容器注册表。

# Pull the latest image
docker pull ghcr.io/macromnex/prottrans_mcp:latest

# Register with Claude Code (runs as current user to avoid permission issues)
claude mcp add prottrans -- docker run -i --rm --user `id -u`:`id -g` --gpus all --ipc=host -v `pwd`:`pwd` ghcr.io/macromnex/prottrans_mcp:latest

注: 从项目目录运行。 `pwd` 展开到当前工作目录。

要求:

  • 支持GPU的Docker(nvidia-docker 或带有NVIDIA运行时的Docker)
  • 已安装克劳德代码

就是这样!ProtTrans MCP服务器现在可以在Claude Code中使用。


方法2:在本地构建Docker镜像

自己构建映像并将其安装到Claude Code中。适用于自定义或离线环境。

# Clone the repository
git clone https://github.com/MacromNex/prottrans_mcp.git
cd prottrans_mcp

# Build the Docker image
docker build -t prottrans_mcp:latest .

# Register with Claude Code (runs as current user to avoid permission issues)
claude mcp add prottrans -- docker run -i --rm --user `id -u`:`id -g` --gpus all --ipc=host -v `pwd`:`pwd` prottrans_mcp:latest

注: 从项目目录运行。 `pwd` 展开到当前工作目录。

要求:

  • 支持GPU的Docker
  • 已安装克劳德代码
  • Git(克隆存储库)

关于Docker标志:

  • -i --Claude Code的交互模式
  • --rm --退出后自动移除容器
  • --user `id -u`:`id -g` --以当前用户身份运行容器,因此输出文件归您所有(不是root)
  • --gpus all --授予对所有可用GPU的访问权限
  • --ipc=host --将主机IPC命名空间用于PyTorch共享内存
  • -v --装载您的项目目录,以便容器可以访问您的数据

验证安装

添加MCP服务器后,您可以验证它是否正常工作:

# List registered MCP servers
claude mcp list

# You should see 'prottrans' in the output

在Claude Code中,您现在可以使用所有4个ProtTrans工具:

  • prottrans_extract_embeddings
  • prottrans_calculate_llh
  • prottrans_train_fitness_model
  • prottrans_predict_fitness

后续步骤

  • 详细文件:参见 detail.md 有关以下内容的全面指南:
    • 可用的MCP工具和参数
    • 本地Python环境设置(Docker的替代方案)
    • 示例工作流和用例
    • 数据格式要求
    • 故障排除

使用示例

注册后,您可以直接在Claude Code中使用ProtTrans工具。以下是一些常见的工作流程:

示例1:训练健身模型

Can you help train a ProtTrans model for data at /path/to/example/ and save it to /path/to/results/prot-t5_fitness using the prottrans MCP server with ProtT5-XL model. Please create the embeddings first if not ready.

示例2:计算对数似然

Can you help calculate ProtBERT likelihood for data at /path/to/data.csv with wild-type sequence at /path/to/wt.fasta using the prottrans MCP server?

示例3:全健身建模工作流程

I have protein variant data at /path/to/variants.csv with log_fitness column. Please:
1. Extract ProtT5-XL embeddings using prottrans_extract_embeddings
2. Train an SVR fitness model using prottrans_train_fitness_model with 5-fold CV
3. Report the mean Spearman correlation performance

故障排除

找不到Docker?

docker --version  # Install Docker if missing

GPU无法访问?

  • 确保安装了NVIDIA Docker运行时
  • 请检查: docker run --gpus all ubuntu nvidia-smi

未找到克劳德代码?

# Install Claude Code
npm install -g @anthropic-ai/claude-code

GPU内存不足?

  • ProtT5 XL需要8-16GB的VRAM
  • 使用 device: "cpu" 用于CPU推理(较慢)
  • 使用ProtAlbert降低内存需求

许可证

麻省理工学院——基于 ProtTrans Elnaggar等人。