mcpField
A
archs4-database

archs4-database

github.com/jaechang-hits数据与数据库38438 次安装6 天前更新
代码仓库

关于 archs4-database

archs4-database 是面向使用 ARCHS4 人类和小鼠基因表达数据的研究者的技能。它介绍如何通过无需认证的 REST API 查询组织表达、共表达和样本元数据,以及使用可下载的 HDF5 矩阵。

主要功能

  1. 01按组织查询基因表达 z 分数
  2. 02查找共表达基因
  3. 03搜索 RNA-seq 样本元数据
  4. 04获取基因级摘要
  5. 05访问批量 HDF5 表达矩阵

适用场景

  1. 01检查基因的组织特异性表达
  2. 02为分析查找共表达伙伴
  3. 03按疾病或组织关键词查找样本
  4. 04比较基因在不同组织中的表达

安装

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

$npx skills add https://github.com/jaechang-hits/sciagent-skills --skill archs4-database

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

详细介绍

ARCHS4 数据库

概述

ARCHS4(All RNA-seq and ChIP-seq Sample and Signature Search)是一个资源,收录了来自 NCBI GEO 和 SRA、经过统一比对和处理的人类与小鼠 RNA-seq 数据,涵盖超过 100 万个样本。https://maayanlab.cloud/archs4/api/ 上的 REST API 提供基因级表达谱、经过 z-score 标准化的组织表达数据、共表达网络和样本元数据搜索,且无需身份验证。大规模批量查询也可使用可下载的 HDF5 表达矩阵。

适用场景

  • 获取感兴趣基因在数百种组织类型中的组织特异性或细胞类型特异性表达 z-score
  • 查找与查询基因共表达的基因(构建共表达网络或进行基于关联的推断分析)
  • 按组织、疾病或元数据关键词搜索 RNA-seq 样本,以确定可供重新分析的候选数据集
  • 比较多个基因在不同组织中的表达谱,为湿实验后续验证筛选候选基因
  • 获取经过统一处理的基因表达矩阵(HDF5 格式),用于大规模跨研究分析
  • 通过检查某基因的表达方向是否符合群体水平的组织表达谱,验证差异表达结果
  • 使用 omics-plotting SKILL 根据查询结果绘制条形图和表达热图
  • 如需查询变异水平的群体等位基因频率,请使用 gnomad-database;ARCHS4 仅提供表达证据
  • 如需根据基因列表进行 Enrichr 通路富集,请使用 gget-genomic-databases(gget enrichr);ARCHS4 用于表达查询

前提条件

  • Python 软件包:requests、pandas、matplotlib、seaborn
  • 数据要求:基因符号(HGNC 格式,例如 TP53、BRCA1);直接查询样本时需提供 GEO/SRA 样本 ID
  • 环境:需要互联网连接;无需 API 密钥或账户
  • 速率限制:约 10 次请求/秒;顺序查询基因时,请在请求之间添加 time.sleep(0.1),以避免触发限流
pip install requests pandas matplotlib seaborn

快速开始

import requests

ARCHS4_BASE = "https://maayanlab.cloud/archs4/api/v1"

def archs4_get(endpoint: str, params: dict = None) -> dict:
    """Send a GET request to the ARCHS4 API and return parsed JSON."""
    r = requests.get(f"{ARCHS4_BASE}/{endpoint}", params=params, timeout=30)
    r.raise_for_status()
    return r.json()

# Quick check: top tissues expressing TP53
data = archs4_get("meta/genes/TP53/zscore")
tissues = data.get("values", [])
print(f"TP53 tissue expression entries: {len(tissues)}")
top5 = sorted(tissues, key=lambda x: x.get("zscore", 0), reverse=True)[:5]
for t in top5:
    print(f"  {t['tissue']:<40}  z={t['zscore']:.2f}")
# TP53 tissue expression entries: 200
#   thymus                                   z=2.81
#   testis                                   z=2.44

核心 API

查询 1:跨组织的基因表达 Z-Score

获取某个基因在所有可用组织类型中的 z-score 标准化表达数据。Z-score 按样本相对于总体分布计算;正值表示表达高于平均水平。

import requests
import pandas as pd

ARCHS4_BASE = "https://maayanlab.cloud/archs4/api/v1"

def get_gene_tissue_zscore(gene_symbol: str, species: str = "human") -> pd.DataFrame:
    """Return tissue z-score expression profile for a gene.

    Parameters
    ----------
    gene_symbol : str
        HGNC gene symbol (e.g., 'TP53').
    species : str
        'human' or 'mouse' (default: 'human').
    """
    endpoint = f"meta/genes/{gene_symbol}/zscore"
    r = requests.get(
        f"{ARCHS4_BASE}/{endpoint}",
        params={"species": species},
        timeout=30
    )
    r.raise_for_status()
    data = r.json()
    records = data.get("values", [])
    df = pd.DataFrame(records)
    return df.sort_values("zscore", ascending=False).reset_index(drop=True)

df = get_gene_tissue_zscore("MYC")
print(f"MYC tissue z-scores: {len(df)} tissue types")
print(df[["tissue", "zscore"]].head(10).to_string(index=False))
# MYC tissue z-scores: 200
#                     tissue  zscore
#                      colon    3.12
#             small intestine    2.98
#                    placenta    2.74
# Query mouse tissues for a gene
df_mouse = get_gene_tissue_zscore("Myc", species="mouse")
print(f"Mouse Myc: top 5 tissues")
print(df_mouse[["tissue", "zscore"]].head(5).to_string(index=False))
查询 2:共表达基因

查找在所有 ARCHS4 样本中与查询基因表达相关性最高的基因。适用于识别通路伙伴、调控因子或候选靶点。

import requests
import pandas as pd

ARCHS4_BASE = "https://maayanlab.cloud/archs4/api/v1"

def get_coexpressed_genes(gene_symbol: str, top_n: int = 50,
                           species: str = "human") -> pd.DataFrame:
    """Return genes co-expressed with the query gene.

    Parameters
    ----------
    gene_symbol : str
        HGNC gene symbol.
    top_n : int
        Number of correlated genes to return (default: 50).
    species : str
        'human' or 'mouse' (default: 'human').
    """
    r = requests.get(
        f"{ARCHS4_BASE}/meta/genes/{gene_symbol}/correlations",
        params={"species": species, "limit": top_n},
        timeout=30
    )
    r.raise_for_status()
    data = r.json()
    records = data.get("values", [])
    df = pd.DataFrame(records)
    return df.sort_values("correlation", ascending=False).reset_index(drop=True)

coexp = get_coexpressed_genes("PCNA", top_n=20)
print(f"Top co-expressed genes with PCNA (n={len(coexp)}):")
print(coexp[["gene", "correlation"]].head(10).to_string(index=False))
# Top co-expressed genes with PCNA (n=20):
#   gene  correlation
#   RFC4         0.91
#   RFC2         0.89
#   MCM6         0.87
# Extract gene list for downstream enrichment
gene_list = coexp["gene"].tolist()
print(f"Co-expression gene list: {gene_list[:10]}")
# Pass gene_list to Enrichr or pathway analysis tools
查询 3:样本搜索

按元数据关键词(组织、疾病状况、细胞类型、处理条件)搜索 RNA-seq 样本。返回包含元数据字段的 GEO/SRA 样本标识符。

import requests
import pandas as pd

ARCHS4_BASE = "https://maayanlab.cloud/archs4/api/v1"

def search_samples(keyword: str, species: str = "human",
                   limit: int = 100) -> pd.DataFrame:
    """Search ARCHS4 samples by metadata keyword.

    Parameters
    ----------
    keyword : str
        Search term (e.g., 'breast cancer', 'liver', 'HeLa').
    species : str
        'human' or 'mouse'.
    limit : int
        Maximum number of samples to return.
    """
    r = requests.get(
        f"{ARCHS4_BASE}/samples/search",
        params={"query": keyword, "species": species, "limit": limit},
        timeout=30
    )
    r.raise_for_status()
    data = r.json()
    records = data.get("samples", [])
    return pd.DataFrame(records)

samples = search_samples("pancreatic cancer", limit=50)
print(f"Samples matching 'pancreatic cancer': {len(samples)}")
if len(samples) > 0:
    print(samples[["sample_id", "series_id", "title"]].head(5).to_string(index=False))
# Samples matching 'pancreatic cancer': 50
#   sample_id  series_id  title
#   GSM2345678  GSE123456  Pancreatic ductal adenocarcinoma - sample 1
查询 4:基因级元数据摘要

获取某个基因的汇总统计数据和元数据,包括表达该基因的样本数量、表达百分位数及可用注释。

import requests

ARCHS4_BASE = "https://maayanlab.cloud/archs4/api/v1"

def get_gene_metadata(gene_symbol: str, species: str = "human") -> dict:
    """Return metadata and expression summary for a gene."""
    r = requests.get(
        f"{ARCHS4_BASE}/meta/genes/{gene_symbol}",
        params={"species": species},
        timeout=30
    )
    r.raise_for_status()
    return r.json()

meta = get_gene_metadata("GAPDH")
print(f"Gene: {meta.get('gene_symbol', 'N/A')}")
print(f"Species: {meta.get('species', 'N/A')}")
print(f"Ensembl ID: {meta.get('ensembl_gene_id', 'N/A')}")
print(f"Description: {meta.get('description', 'N/A')[:80]}")
# Compare metadata for a panel of housekeeping genes
import time

housekeeping = ["GAPDH", "ACTB", "B2M", "HPRT1", "RPLP0"]
for gene in housekeeping:
    meta = get_gene_metadata(gene)
    print(f"  {gene:<8}  {meta.get('ensembl_gene_id', 'N/A')}")
    time.sleep(0.1)
查询 5:可视化——组织表达条形图

获取 z-score 最高的组织,然后阅读 skills/data-visualization/omics-plotting/SKILL.md,并按照其中的“Box / Violin / Bar”方法处理导出的 CSV(→ figures/BRCA1_tissue_expression.png)。

import requests
import pandas as pd

ARCHS4_BASE = "https://maayanlab.cloud/archs4/api/v1"

def tissue_zscores(gene_symbol: str, top_n: int = 20, species: str = "human") -> pd.DataFrame:
    """Fetch top tissue z-scores for a gene and save for plotting."""
    r = requests.get(
        f"{ARCHS4_BASE}/meta/genes/{gene_symbol}/zscore",
        params={"species": species},
        timeout=30,
    )
    r.raise_for_status()
    df = pd.DataFrame(r.json().get("values", [])).sort_values("zscore", ascending=False).head(top_n)
    df.to_csv(f"{gene_symbol}_tissue_zscores.csv", index=False)
    return df

df = tissue_zscores("BRCA1", top_n=15)
print(f"Top tissues for BRCA1: {len(df)} -> BRCA1_tissue_zscores.csv")
# Render with the omics-plotting SKILL (`skills/data-visualization/omics-plotting/SKILL.md`) "Box / Violin / Bar" recipe (horizontal bar of zscore by tissue).
查询 6:HDF5 批量数据访问

下载 ARCHS4 预计算的 HDF5 表达矩阵,或从中读取数据流,用于大规模跨样本分析。HDF5 文件包含人类和小鼠的基因 × 样本计数矩阵。

import requests

# HDF5 files are available for bulk download from the ARCHS4 data portal
# URL pattern: https://maayanlab.cloud/archs4/download#expression
# Human gene-level: human_gene_v2.6.h5
# Mouse gene-level: mouse_gene_v2.6.h5

def get_h5_download_urls() -> dict:
    """Return download URLs for ARCHS4 HDF5 expression matrices."""
    base = "https://maayanlab.cloud/archs4"
    return {
        "human_gene": f"{base}/files/human_gene_v2.6.h5",
        "mouse_gene": f"{base}/files/mouse_gene_v2.6.h5",
        "human_transcript": f"{base}/files/human_transcript_v2.6.h5",
        "mouse_transcript": f"{base}/files/mouse_transcript_v2.6.h5",
    }

urls = get_h5_download_urls()
for key, url in urls.items():
    print(f"  {key:<22}  {url}")

# To work with a downloaded HDF5 file:
try:
    import h5py
    import numpy as np

    h5_path = "human_gene_v2.6.h5"   # after download

    def extract_gene_from_h5(h5_path: str, gene_symbol: str,
                              n_samples: int = 1000) -> dict:
        """Extract expression values for a gene from the HDF5 matrix."""
        with h5py.File(h5_path, "r") as f:
            genes = [g.decode() for g in f["meta"]["genes"]["gene_symbol"][:]]
            if gene_symbol not in genes:
                raise ValueError(f"{gene_symbol} not found in HDF5")
            idx = genes.index(gene_symbol)
            expr = f["data"]["expression"][idx, :n_samples]
            sample_ids = [s.decode() for s in f["meta"]["samples"]["geo_accession"][:n_samples]]
        return {"gene": gene_symbol, "expression": expr, "sample_ids": sample_ids}

    result = extract_gene_from_h5(h5_path, "TP53", n_samples=500)
    print(f"TP53 expression: mean={result['expression'].mean():.2f},"
          f" max={result['expression'].max():.2f} (n={len(result['expression'])} samples)")
except ImportError:
    print("h5py not installed. Install with: pip install h5py")
except FileNotFoundError:
    print("HDF5 file not downloaded yet. Use the URLs above to download first.")

核心概念

Z-Score 标准化

ARCHS4 将基因表达报告为相对于该基因所有样本计算的 z-score。z-score 为 0 表示表达处于总体平均值;z-score 为 2.0 表示表达高于平均值 2 个标准差。与原始计数相比,z-score 更便于跨数据集解读,因为它考虑了文库大小差异,以及跨研究统一比对所引入的批次效应。

# Example: Positive z-score = above-average expression for that gene
# z > 2.0 → top ~2.5% of samples for that gene
# z < -2.0 → bottom ~2.5% of samples for that gene
# Use absolute z-score thresholds consistently when comparing across genes
HDF5 与 REST API
访问方式最适合局限性
REST API (/zscore, /correlations)快速查询单个基因、探索仅提供聚合表达谱,无法按样本访问
REST API (/samples/search)查找相关数据集返回元数据,而非表达值
HDF5 下载批量分析、自定义共表达分析、ML需要 30–60 GB 磁盘空间;仅需下载一次
物种和基因符号约定

ARCHS4 使用 HGNC 基因符号(大写,例如 TP53)索引人类样本,使用 MGI 符号(首字母大写,例如 Trp53)索引小鼠样本。species 参数接受 "human" 或 "mouse"。大小写混合的符号或 ensemble ID 会返回空结果。

常见工作流

工作流 1:多基因组织表达热图

目标:比较一组基因的组织表达谱,并以热图可视化,从而识别组织特异性与广泛表达模式。

import requests, time
import pandas as pd

ARCHS4_BASE = "https://maayanlab.cloud/archs4/api/v1"

gene_panel = ["MYC", "TP53", "BRCA1", "EGFR", "KRAS", "CDK4"]
top_n_tissues = 25

def get_tissue_zscores(gene: str) -> pd.Series:
    r = requests.get(
        f"{ARCHS4_BASE}/meta/genes/{gene}/zscore",
        params={"species": "human"},
        timeout=30
    )
    r.raise_for_status()
    records = r.json().get("values", [])
    df = pd.DataFrame(records).set_index("tissue")["zscore"]
    return df

# Build expression matrix (genes × tissues)
all_data = {}
for gene in gene_panel:
    try:
        all_data[gene] = get_tissue_zscores(gene)
        print(f"  Fetched {gene}")
    except Exception as e:
        print(f"  Warning: {gene} failed — {e}")
    time.sleep(0.1)

matrix = pd.DataFrame(all_data).T   # genes × tissues
# Select top tissues by max absolute z-score
tissue_importance = matrix.abs().max(axis=0).sort_values(ascending=False)
top_tissues = tissue_importance.head(top_n_tissues).index
matrix_subset = matrix[top_tissues]

# Save the gene × tissue matrix; render with the omics-plotting SKILL (`skills/data-visualization/omics-plotting/SKILL.md`) "Expression heatmap"
# recipe (RdBu_r, center=0) -> figures/archs4_panel_heatmap.png
matrix_subset.to_csv("archs4_panel_matrix.csv")
print(f"Panel matrix ready: {matrix_subset.shape} -> archs4_panel_matrix.csv")
工作流 2:扩展共表达网络种子基因

目标:从一个种子基因开始,检索共表达伙伴,然后依次查询这些伙伴的共表达基因,构建两跳共表达邻域。

import requests, time
import pandas as pd

ARCHS4_BASE = "https://maayanlab.cloud/archs4/api/v1"

def get_coexp(gene: str, top_n: int = 20, species: str = "human") -> list:
    r = requests.get(
        f"{ARCHS4_BASE}/meta/genes/{gene}/correlations",
        params={"species": species, "limit": top_n},
        timeout=30
    )
    r.raise_for_status()
    return [rec["gene"] for rec in r.json().get("values", [])]

seed_gene = "PCNA"
min_correlation = 0.80

# Hop 1: direct co-expressed partners
hop1_genes = get_coexp(seed_gene, top_n=30)
print(f"Hop 1 partners of {seed_gene}: {len(hop1_genes)}")
time.sleep(0.1)

# Hop 2: co-expressed genes of each partner
edges = set()
for gene in hop1_genes[:10]:   # limit for demonstration
    partners = get_coexp(gene, top_n=20)
    for partner in partners:
        if partner != seed_gene:
            edges.add((gene, partner))
    time.sleep(0.1)

# Summarize the network
network_df = pd.DataFrame(list(edges), columns=["source", "target"])
hub_counts = network_df["source"].value_counts()
print(f"\nTwo-hop network: {len(edges)} edges")
print(f"Top hub genes:")
print(hub_counts.head(5))

network_df.to_csv(f"{seed_gene}_coexp_network.csv", index=False)
print(f"\nSaved {seed_gene}_coexp_network.csv")
工作流 3:样本查找与数据集摘要

目标:按疾病关键词搜索样本,汇总可用 GEO 系列的数量,并导出样本元数据,以便后续选择重新分析的数据集。

import requests, time
import pandas as pd

ARCHS4_BASE = "https://maayanlab.cloud/archs4/api/v1"

def search_and_summarize(keyword: str, species: str = "human",
                          limit: int = 200) -> pd.DataFrame:
    """Search samples and return a tidy metadata DataFrame."""
    r = requests.get(
        f"{ARCHS4_BASE}/samples/search",
        params={"query": keyword, "species": species, "limit": limit},
        timeout=30
    )
    r.raise_for_status()
    records = r.json().get("samples", [])
    return pd.DataFrame(records)

keyword = "colorectal cancer"
df = search_and_summarize(keyword, limit=150)
print(f"Samples matching '{keyword}': {len(df)}")

if len(df) > 0:
    # Summarize by GEO series
    series_counts = df["series_id"].value_counts()
    print(f"\nTop GEO series (by sample count):")
    print(series_counts.head(8).to_string())

    # Export sample list
    df.to_csv(f"{keyword.replace(' ', '_')}_samples.csv", index=False)
    print(f"\nSaved {keyword.replace(' ', '_')}_samples.csv ({len(df)} samples)")
    print(f"Unique GEO series: {df['series_id'].nunique()}")

关键参数

参数端点默认值范围 / 选项作用
species所有基因端点"human""human"、"mouse"选择对应物种的样本索引
limit/correlations、/samples/search1001–500返回结果数量
gene_symbol(路径)/meta/genes/{gene}/zscore、/correlations—HGNC 符号(人类)或 MGI 符号(小鼠)查询基因;区分大小写
query/samples/search—自由文本字符串在标题、组织和来源字段中搜索元数据关键词
offset/samples/search0整数大型结果集的分页偏移量
correlation(响应字段)/correlations—-1.0–1.0Pearson 相关系数;筛选 > 0.7 可查找高共表达
zscore(响应字段)/zscore—连续浮点数表达 z 分数;> 2.0 表示高表达
page_size(HDF5)HDF5 切片全部任意整数每次从 HDF5 读取时提取的样本数量

最佳实践

  1. 始终如一地使用 z 分数阈值:由于 z 分数具有基因特异性,广泛表达基因(GAPDH)和组织受限表达基因(TTR,肝脏)的 z 分数 2.0,解释意义并不相同。务必注明比较的基因和组织背景。

  2. 批量查询之间暂停:ARCHS4 实施了约 10 次请求/秒的软速率限制。在依次查询基因时,添加 time.sleep(0.1),以避免出现 429 Too Many Requests 错误。

  3. 大规模分析请下载 HDF5:对于涵盖 50 个以上基因或需要按样本获取表达值的查询,REST API 并不实用。下载一次 HDF5 文件,并使用 h5py 切片快速访问矩阵;这样可避免触发速率限制,批量提取速度也快 100 倍。

  4. 根据物种匹配基因符号约定:人类查询需要 HGNC 大写符号(例如 TP53);小鼠查询需要 MGI 风格的符号(例如 Trp53)。大小写错误会导致返回空结果,且不会报错。

  5. 在不同数据集中验证共表达结果:ARCHS4 的共表达数据聚合了所有组织类型。高相关性可能由单一组织或研究驱动。请通过组织特异性查询进行交叉核验,或手动检查贡献最高的 GEO 系列。

常见用法

配方:快速检查组织特异性

适用场景:在设计实验前,快速确定某个基因是广泛表达(管家基因)还是仅在特定组织中表达。

import requests

ARCHS4_BASE = "https://maayanlab.cloud/archs4/api/v1"

def tissue_specificity_summary(gene_symbol: str) -> None:
    """Print a summary of high and low expression tissues for a gene."""
    r = requests.get(
        f"{ARCHS4_BASE}/meta/genes/{gene_symbol}/zscore",
        params={"species": "human"},
        timeout=30
    )
    r.raise_for_status()
    records = r.json().get("values", [])
    zscores = [rec["zscore"] for rec in records if rec.get("zscore") is not None]
    top_high = sorted(records, key=lambda x: x.get("zscore", 0), reverse=True)[:5]
    top_low = sorted(records, key=lambda x: x.get("zscore", float("inf")))[:3]
    print(f"\n{gene_symbol} — {len(zscores)} tissues")
    print(f"  Range: [{min(zscores):.2f}, {max(zscores):.2f}]  "
          f"Mean: {sum(zscores)/len(zscores):.2f}")
    print("  High expression:")
    for t in top_high:
        print(f"    {t['tissue']:<35}  z={t['zscore']:.2f}")
    print("  Low expression:")
    for t in top_low:
        print(f"    {t['tissue']:<35}  z={t['zscore']:.2f}")

tissue_specificity_summary("TTR")   # Transthyretin — liver-specific
配方:批量基因共表达表

适用场景:根据一组差异表达基因,生成基因面板的两两相关性表。

import requests, time
import pandas as pd

ARCHS4_BASE = "https://maayanlab.cloud/archs4/api/v1"

def batch_coexpr_table(gene_list: list, top_n: int = 10) -> pd.DataFrame:
    """For each gene in gene_list, return its top co-expressed genes."""
    rows = []
    for gene in gene_list:
        try:
            r = requests.get(
                f"{ARCHS4_BASE}/meta/genes/{gene}/correlations",
                params={"species": "human", "limit": top_n},
                timeout=30
            )
            r.raise_for_status()
            for rec in r.json().get("values", []):
                rows.append({
                    "query_gene": gene,
                    "coexp_gene": rec.get("gene"),
                    "correlation": rec.get("correlation"),
                })
            time.sleep(0.1)
        except Exception as e:
            print(f"Warning: {gene} skipped — {e}")
    return pd.DataFrame(rows)

deg_list = ["MYC", "CCND1", "CDK4", "RB1", "E2F1"]
coexp_table = batch_coexpr_table(deg_list, top_n=10)
print(f"Co-expression entries: {len(coexp_table)}")
print(coexp_table.groupby("query_gene")["coexp_gene"].count())
coexp_table.to_csv("deg_coexpression_table.csv", index=False)
print("Saved deg_coexpression_table.csv")
配方:导出用于 GEO 下载的样本 ID

适用场景:确定用于 Meta 分析的相关 GEO 登录号,以下载原始计数矩阵。

import requests
import pandas as pd

ARCHS4_BASE = "https://maayanlab.cloud/archs4/api/v1"

keyword = "glioblastoma"
r = requests.get(
    f"{ARCHS4_BASE}/samples/search",
    params={"query": keyword, "species": "human", "limit": 200},
    timeout=30
)
r.raise_for_status()
samples = pd.DataFrame(r.json().get("samples", []))
if len(samples) > 0:
    # Get unique GEO series accessions
    series = samples["series_id"].dropna().unique()
    print(f"Unique GEO series for '{keyword}': {len(series)}")
    for s in series[:10]:
        n = (samples["series_id"] == s).sum()
        print(f"  {s}  ({n} samples)")
    # Export series list for GEO download script
    pd.Series(series, name="geo_series").to_csv(
        f"{keyword}_geo_series.txt", index=False
    )
    print(f"\nSaved {keyword}_geo_series.txt")

故障排查

问题原因解决方案
基因查询返回 HTTP 404在 ARCHS4 索引中找不到基因符号确认 HGNC 符号拼写;检查 species 参数是否与基因命名规范一致(人类:全大写;小鼠:首字母大写)
HTTP 429 Too Many Requests超出约 10 req/s 的速率限制在请求之间添加 time.sleep(0.1);批量查询时延迟 0.5 s
z-score 响应中的 values 列表为空基因未在任何已索引组织中表达,或物种不正确切换物种;确认该基因为蛋白质编码基因且有 GEO 覆盖
搜索返回的 samples 列表为空关键词与元数据字段不匹配尝试更宽泛或其他关键词(例如,用 "liver" 替代 "hepatic")
未找到 HDF5 基因HDF5 版本中的符号与查询不匹配检查 f["meta"]["genes"]["gene_symbol"][:] 中的可用基因;尝试 Ensembl ID 或别名
requests.exceptions.Timeout负载较高时 API 响应缓慢将 timeout=60 调大;使用指数退避重试
Z-score 都接近零基因在各组织中的表达量极低或不表达检查原始计数中的基因表达量;该基因可能是非编码基因或表达量极低

相关技能

  • gnomad-database — 群体变异频率;在 ARCHS4 之后使用,以识别高表达基因中的变异
  • gget-genomic-databases — 对 ARCHS4 共表达基因列表进行 Enrichr 通路富集(gget enrichr)
  • pydeseq2-differential-expression — 对 bulk RNA-seq 进行差异表达分析;ARCHS4 HDF5 矩阵可用作参考队列

参考资料

评论

支持 Markdown