mcpField
A
alterlab-depmap

alterlab-depmap

github.com/alterlab-ieu数据与数据库7868 次安装5 周前更新
代码仓库

关于 alterlab-depmap

alterlab-depmap 是用于分析 DepMap 癌细胞系遗传依赖数据的技能,面向癌症靶点验证与生物标志物研究。它通过下载发布版矩阵并在本地分析,支持依赖性、敏感性和共依赖关系研究。

主要功能

  1. 01通过 Figshare 获取发布文件
  2. 02读取 CRISPR 基因效应矩阵
  3. 03识别癌症选择性依赖
  4. 04分析突变与依赖性的关联
  5. 05计算基因共依赖关系
  6. 06分析 PRISM 药物敏感性

适用场景

  1. 01验证特定癌症类型的候选靶点
  2. 02寻找合成致死关系
  3. 03发现依赖性预测生物标志物
  4. 04关联基因组特征与化合物敏感性

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/alterlab-ieu/alterlab-academic-skills --skill alterlab-depmap

安装后在 Claude Code 中输入/alterlab-depmap确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

evals/
evals.json
references/
dependency_analysis.md
scripts/
query_depmap.py

详细介绍

DepMap — 癌症依赖性图谱

概述

Broad Institute 运营的癌症依赖性图谱(DepMap)项目,通过全基因组 CRISPR 敲除筛选(DepMap CRISPR)、RNA 干扰(RNAi)和化合物敏感性检测(PRISM),系统地表征数百种癌症细胞系中的基因依赖关系。DepMap 数据对于以下工作至关重要:

  • 确定哪些基因对特定癌症类型至关重要
  • 寻找癌症选择性依赖关系(治疗靶点)
  • 验证肿瘤药物靶点
  • 发现合成致死相互作用

关键资源:

访问方式——请先阅读此部分。 DepMap 没有文档说明的稳定公共 REST API 可用于基因级查询;目前门户网站(包括 depmap.org/portal/api/... 和数据页面)都受到 Cloudflare 浏览器验证检查的保护,该检查要求用户不要抓取网站——脚本请求获取到的是验证页面,而非数据。受支持的工作流是:下载发行版矩阵 CSV 文件,然后使用 pandas 在本地进行分析。对于截至 24Q4 的发行版,可通过无需密钥的 Figshare API 以编程方式访问这些文件(/articles/{id}/files?page_size=1000 会列出 name 和 download_url;该端点采用分页,默认每页 10 个文件);scripts/query_depmap.py 对此进行了封装。更新的发行版(从 25Q2 起;最新版本为 26Q1,于 2026 年 4 月发布)需在浏览器中从数据页面下载。对于 Sanger 的 Project Score CRISPR 筛选,有一个无需密钥的 JSON:API:https://api.cellmodelpassports.sanger.ac.uk(限非商业用途)。

何时使用此技能

以下情况可使用 DepMap:

  • 靶点验证:在具有特定突变(例如 KRAS 突变)的癌症细胞系中,某个基因是否为细胞存活所必需?
  • 生物标志物发现:哪些基因组特征可以预测细胞对某个基因敲除的敏感性?
  • 合成致死:寻找在另一个基因发生突变/缺失时才具有选择性必需性的基因
  • 药物敏感性:哪些细胞系特征可以预测细胞对某种化合物的响应?
  • 泛癌必需性:某个基因是否在所有癌症类型中普遍必需(不适合作为靶点),还是仅具有选择性必需性?
  • 相关性分析:哪些基因对具有相关的依赖性特征(共同必需性)?
不适用的情况
场景改用
患者肿瘤中的突变/CNA 频率(TCGA、MSK-IMPACT)和生存情况alterlab-cbioportal
经整理的体细胞突变目录、Cancer Gene Censusalterlab-cosmic
汇总的靶点–疾病证据、可成药性、安全性alterlab-opentargets
化合物对纯化靶点的效力(IC50/Ki)alterlab-chembl

核心概念

依赖性评分
评分范围含义
Chronos(CRISPR)~ -3 至 0+数值越负 = 越必需。常见必需性阈值:−1。泛必需基因约为 −1 至 −2
RNAi DEMETER2~ -3 至 0+与 Chronos 的尺度类似
Gene Effect已归一化归一化后的 Chronos;−1 = 常见必需基因的中位效应

关键阈值:

  • Chronos ≤ −0.5:可能存在依赖性
  • Chronos ≤ −1:强依赖(常见必需性范围)
细胞系注释

Model.csv(当前发行版)每个模型占一行:

  • ModelID:唯一标识符(例如 ACH-000001)——每个矩阵的行索引
  • CellLineName(及 StrippedCellLineName):便于阅读的名称
  • OncotreePrimaryDisease:癌症类型
  • OncotreeLineage:广义组织谱系
  • OncotreeSubtype:具体亚型

2023 年之前发布的版本包含 sample_info.csv,其中有 DepMap_ID、cell_line_name、primary_disease、lineage、lineage_subtype。

核心功能

1. 解析并下载发布文件(Figshare API,无需密钥)

获取某个发布版本的文件清单,按名称解析文件的下载 URL,然后将其流式下载到磁盘。文章 ID:24Q4 = 27993248、24Q2 = 25880521、23Q4 = 24667905。Figshare 托管服务在 24Q4 之后停止;对于较新的发布版本(25Q2+),请从 https://depmap.org/portal/data_page/ 手动下载。

import requests

FIGSHARE = "https://api.figshare.com/v2"

def list_release_files(article_id=27993248):
    """List {name, download_url} for every file in a DepMap release.

    The endpoint is paginated (default 10 files/page); request a large page so
    Model.csv and the Omics files are included.
    """
    r = requests.get(f"{FIGSHARE}/articles/{article_id}/files",
                     params={"page_size": 1000}, timeout=60)
    r.raise_for_status()
    return {f["name"]: f["download_url"] for f in r.json()}

def download_depmap_file(name, article_id=27993248, out_path=None):
    """Resolve `name` to its Figshare URL and stream it to disk."""
    url = list_release_files(article_id)[name]   # KeyError if name not in release
    out_path = out_path or name
    with requests.get(url, stream=True, timeout=300) as r:
        r.raise_for_status()
        with open(out_path, "wb") as f:
            for chunk in r.iter_content(chunk_size=1 << 16):
                f.write(chunk)
    return out_path

# download_depmap_file("CRISPRGeneEffect.csv")   # ~430 MB
# CLI equivalent: scripts/query_depmap.py (see end of file)

细胞系元数据位于 Model.csv(当前发布版本)中;较早的发布版本使用 sample_info.csv。列名也因发布版本而异(DepMap_ID -> ModelID、primary_disease -> OncotreePrimaryDisease、lineage -> OncotreeLineage);请检查已下载文件的表头,不要想当然。

2. 加载基因效应矩阵
import pandas as pd

def load_depmap_gene_effect(filepath="CRISPRGeneEffect.csv"):
    """
    Load DepMap CRISPR gene effect matrix.
    Rows = cell lines (ModelID, e.g. ACH-000001), Columns = genes ("SYMBOL (EntrezID)")
    """
    df = pd.read_csv(filepath, index_col=0)
    # Rename columns to gene symbols only
    df.columns = [col.split(" ")[0] for col in df.columns]
    return df

def load_cell_line_info(filepath="Model.csv"):
    """Load cell line metadata (older releases: sample_info.csv)."""
    return pd.read_csv(filepath)
3. 识别选择性依赖
import numpy as np
import pandas as pd

def find_selective_dependencies(gene_effect_df, cell_line_info, target_gene,
                                 cancer_type=None, threshold=-0.5):
    """Find cell lines selectively dependent on a gene."""

    # Get scores for target gene
    if target_gene not in gene_effect_df.columns:
        return None

    scores = gene_effect_df[target_gene].dropna()
    dependent = scores[scores <= threshold]

    # Add cell line info (Model.csv column names; see Cell Line Annotations)
    result = pd.DataFrame({
        "ModelID": dependent.index,
        "gene_effect": dependent.values
    }).merge(cell_line_info[["ModelID", "CellLineName", "OncotreePrimaryDisease",
                             "OncotreeLineage"]])

    if cancer_type:
        result = result[result["OncotreePrimaryDisease"].str.contains(
            cancer_type, case=False, na=False)]

    return result.sort_values("gene_effect")

# Example usage (after loading data; adjust column names to your release header)
# df_effect = load_depmap_gene_effect("CRISPRGeneEffect.csv")
# cell_info = load_cell_line_info("Model.csv")
# deps = find_selective_dependencies(df_effect, cell_info, "KRAS", cancer_type="Lung")
4. 生物标志物分析(基因效应与突变)
import pandas as pd
from scipy import stats

def biomarker_analysis(gene_effect_df, mutation_df, target_gene, biomarker_gene):
    """
    Test if mutation in biomarker_gene predicts dependency on target_gene.

    Args:
        gene_effect_df: CRISPR gene effect DataFrame
        mutation_df: OmicsSomaticMutationsMatrixDamaging (0 = none, 1 = damaging,
            2 = damaging with summed allele fraction > 0.95); rename its
            "SYMBOL (EntrezID)" columns to symbols as for the gene-effect matrix
        target_gene: Gene to assess dependency of
        biomarker_gene: Gene whose mutation may predict dependency
    """
    if target_gene not in gene_effect_df.columns or biomarker_gene not in mutation_df.columns:
        return None

    # Align cell lines
    common_lines = gene_effect_df.index.intersection(mutation_df.index)
    scores = gene_effect_df.loc[common_lines, target_gene].dropna()
    mutations = mutation_df.loc[scores.index, biomarker_gene]

    # Treat 1 and 2 as mutant — "== 1" would drop the (near-)homozygous lines.
    mutated = scores[mutations > 0]
    wt = scores[mutations == 0]

    stat, pval = stats.mannwhitneyu(mutated, wt, alternative='less')

    return {
        "target_gene": target_gene,
        "biomarker_gene": biomarker_gene,
        "n_mutated": len(mutated),
        "n_wt": len(wt),
        "mean_effect_mutated": mutated.mean(),
        "mean_effect_wt": wt.mean(),
        "pval": pval,
        "significant": pval < 0.05
    }
5. 共必需性分析
import pandas as pd

def co_essentiality(gene_effect_df, target_gene, top_n=20):
    """Find genes with most correlated dependency profiles (co-essential partners)."""
    if target_gene not in gene_effect_df.columns:
        return None

    target_scores = gene_effect_df[target_gene].dropna()

    correlations = {}
    for gene in gene_effect_df.columns:
        if gene == target_gene:
            continue
        other_scores = gene_effect_df[gene].dropna()
        common = target_scores.index.intersection(other_scores.index)
        if len(common) < 50:
            continue
        r = target_scores[common].corr(other_scores[common])
        if not pd.isna(r):
            correlations[gene] = r

    corr_series = pd.Series(correlations).sort_values(ascending=False)
    return corr_series.head(top_n)

# Co-essential genes often share biological complexes or pathways

查询工作流

工作流 1:验证某种癌症类型的靶点
  1. 下载 CRISPRGeneEffect.csv 和细胞系元数据文件(Model.csv;较早的发布版本使用 sample_info.csv)
  2. 按癌症类型筛选细胞系
  3. 计算目标基因在该癌症类型与所有其他类型中的平均基因效应
  4. 计算选择性:该依赖对你的癌症类型有多特异?
  5. 将突变、表达或 CNA 数据作为生物标志物进行交叉比对
工作流 2:合成致死筛选
  1. 找出目标基因发生突变或缺失的细胞系(例如,BRCA1 突变型)
  2. 计算突变型与野生型细胞系中所有基因的基因效应分数
  3. 找出在突变型细胞系中显著更必需的基因(合成致死伙伴)
  4. 根据选择性和效应大小进行筛选
工作流 3:化合物敏感性分析
  1. 下载 PRISM 化合物敏感性数据(数据页面上的独立 PRISM Repurposing 数据集,不属于季度 CRISPR/Omics 发布版本)
  2. 将化合物 AUC/log2(fold-change) 与基因组特征进行相关性分析
  3. 找出化合物敏感性的预测性生物标志物

DepMap 数据文件参考

文件说明
CRISPRGeneEffect.csvCRISPR Chronos 基因效应(主要依赖数据)
CRISPRGeneEffectUncorrected.csv未进行拷贝数校正或缩放的 Chronos 分数
CRISPRGeneDependency.csv每个基因在每个细胞系中属于依赖基因的概率
Model.csv细胞系元数据(谱系、疾病等);较早的发布版本使用 sample_info.csv
OmicsExpressionProteinCodingGenesTPMLogp1.csvmRNA 表达
OmicsSomaticMutationsMatrixDamaging.csv有害体细胞突变(0 表示无 / 1 表示有害 / 2 表示有害,AF 总和 > 0.95)
OmicsCNGene.csv每个基因的拷贝数

已根据 24Q4 的文件清单(73 个文件)进行核验。DEMETER2 RNAi 和 PRISM 药物敏感性数据是数据页面上的独立数据集,不属于季度发布版本。不同发布版本的文件名略有差异;编写脚本前请对照文件清单(query_depmap.py list 或门户数据页面)进行确认。

最佳实践

  • 使用 Chronos 分数(而非 DEMETER2)进行当前的 CRISPR 分析——对切割效率的控制更好
  • 区分泛必需与癌症选择性:方差较低的靶基因(在所有细胞系中都必需)不是理想的药物靶点
  • 使用表达数据进行验证:如果某个基因在细胞系中不表达,无论其实际功能如何,都会被判定为非必需
  • 使用 DepMap ID 识别细胞系——cell_line_name 可能含义不明确
  • 考虑拷贝数的影响:扩增的基因可能因拷贝数效应而看似必需(垃圾 DNA 假说)
  • 进行多重检验校正:在全基因组范围计算生物标志物关联时,应用 FDR 校正

其他资源

脚本

scripts/query_depmap.py — 无需密钥的辅助脚本,可列出 DepMap 版本的文件,并通过 Figshare API 获取文件的下载 URL(--article 应放在子命令之前):

uv run --with requests python scripts/query_depmap.py --article 27993248 list
uv run --with requests python scripts/query_depmap.py --article 27993248 url CRISPRGeneEffect.csv

评论

支持 Markdown