DepMap基因相关性分析工具 - MCP服务器

A MCP tool from Prism ToolSpace for analyzing gene-gene correlations from the DepMap (Dependency Map) CRISPR knockout screening dataset. This tool processes systematic CRISPR-Cas9 knockout data from over 1,320 cancer cell lines from DepMap 24Q2 to identify genetic dependencies and co-essential gene pairs.

先决条件

1. Install Required Dependencies

安装 DepMap 相关性分析所需的 Python 包:

# Create a virtual environment for DepMap setup
uv venv depmap --python 3.10
source depmap/bin/activate
uv pip install -r requirements.txt

数据设置

1. Download DepMap 24Q2 Dataset

Download the preprocessed DepMap correlation data from the Prism ToolSpace or prepare your own correlation matrices:

# Install CLI if not already
uvx --from huggingface_hub hf

# Download only the depmap_24q2 folder
uvx --from huggingface_hub hf download mims-harvard/ToolSpace \
  --repo-type dataset \
  --include "depmap_24q2/*" \
  --local-dir ./path/to/your/depmap/

必需文件:

  • 基因相关矩阵 - 基因之间的成对相关性

  • P 值矩阵 - 相关性的统计显著性

  • 基因索引 - 基因符号到矩阵索引的映射

  • 调整后的 p 值(可选)- FDR 校正的 p 值

数据源:

  • DepMap门户: https://depmap.org/portal/download/

  • DepMap 24Q2 发布版:包含针对1,320+细胞系的CRISPR敲除数据

  • CERES 算法:用于依赖性分析的标准化基因效应评分

2. Directory Structure Setup

为您的 DepMap 数据创建以下目录结构:

/path/to/your/depmap/
├── depmap_24q2/              # DepMap data directory
│   ├── corr_matrix.npy       # Gene correlation matrix (dense format)
│   ├── p_val_matrix.npy      # P-value matrix (dense format)
│   ├── p_adj_matrix.npy      # Adjusted p-values (optional)
│   ├── gene_idx_array.npy    # Gene symbol index array
│   └── gene_names.txt        # Gene symbols (alternative format)
│   # Alternative sparse format for large datasets:
│   └── gene_correlations.h5  # HDF5 sparse matrices

3. Set Environment Variable

DEPMAP_DATA_PATH 环境变量设置为指向您的 DepMap 安装位置:

# Add to your ~/.bashrc or ~/.zshrc
export DEPMAP_DATA_PATH="/path/to/your/depmap"

输入和输出规格

输入格式

该工具接受基因符号对进行相关性分析:

  • 基因符号:标准HUGO基因命名法(例如,“BRAF”、“TP53”、“MAPK1”)

  • 不区分大小写:工具会自动标准化基因符号

  • 验证:检查相关矩阵中的基因可用性

输出格式

该工具返回一个结构化的JSON响应,其中包含全面的相关性分析:

{
  "correlation_data": {
    "correlation": 0.756,
    "p_value": 1.23e-15,
    "adjusted_p_value": 4.56e-12
  },
  "interpretation": {
    "strength": "strong",
    "significance": "significant (FDR corrected)",
    "direction": "similar",
    "biological_relationship": "co-dependent relationship (shared essential functions)",
    "summary": "DepMap analysis reveals a strong, similar correlation (r=0.756) in knockout effects between BRAF and MAPK1, suggesting co-dependent relationship (shared essential functions). This finding is significant (FDR corrected)."
  },
  ...
}

输出字段:

  • correlation_data(字典):统计指标

    • correlation(浮点数):皮尔逊相关系数(-1.0 至 1.0)

    • p_value(浮点数):相关性的统计显著性

    • adjusted_p_value(浮点数,可选):FDR校正后的p值

  • interpretation(词典):生物学和统计学背景

    • strength (str):相关强度分类

    • significance (str):统计显著性解释

    • direction(字符串):关系类型(相似效果与相反效果)

    • biological_relationship(字符串):生物学解释

    • summary(字符串):综合分析摘要

  • context_info(列表):分析元数据和消息

  • error(字符串,可选):分析失败时的错误描述

运行 MCP 服务器

1. Start the Server

# Activate the virtual environment
source depmap/bin/activate

# Set environment variable (if not in bashrc)
export DEPMAP_DATA_PATH="/path/to/your/depmap"

# Run the MCP server
python depmap_24q2_mcp_tool.py

2. Server Configuration

服务器以以下默认设置运行:

  • 主机0.0.0.0(接受来自任何IP的连接)

  • 端口7002(已配置以避免冲突)

  • 传输streamable-http

  • 模式:无状态 HTTP

常见问题

  1. 未找到数据目录

    FileNotFoundError: DepMap data directory not found at /path/to/data
    
    • 确保正确设置 DEPMAP_DATA_PATH

    • 验证 depmap_24q2/ 子目录是否存在

    • 检查相关矩阵是否已正确下载

  2. 未找到基因符号

    KeyError: Gene 'INVALID' not available in the DepMap correlation matrix
    
    • 核实基因符号拼写(使用标准HUGO命名法)

    • 检查基因是否存在于 DepMap 24Q2 数据集中

    • 尝试使用其他基因符号或别名

  3. 缺失的关联数据

    FileNotFoundError: No correlation data found in directory
    
    • 确保相关矩阵格式正确(.npy 或 .h5)

    • 确认基因索引文件是否存在(gene_idx_array.npygene_names.txt

    • 检查文件权限及可访问性

参考文献