Communitygithub.com

deepTools: NGS 数据分析工具包

NGS 分析工具包。实现 BAM 到 bigWig 的转换、质量控制(相关性、PCA、指纹图谱)、热图/谱图(TSS、峰区),适用于 ChIP-seq、RNA-seq、ATAC-seq 可视化。

deepTools: NGS 数据分析工具包 是什么?

deepTools 是一个全面的 Python 命令行工具套件,专门用于处理和分析高通量测序数据。该技能旨在帮助开发者完成从原始 BAM 文件到出版级可视化结果的全流程分析,包括文件转换、质量控制、样本比较和热图绘制等核心功能。它支持 ChIP-seq、RNA-seq、ATAC-seq 和 MNase-seq 等多种 NGS 实验类型,并提供了丰富的标准化方法(如 RPGC、CPM、RPKM)和参数选项。该技能在 Claude Code 等 AI 代理平台上运行,通过提供完整的参考文档(工具参考、工作流、标准化方法、有效基因组大小)和辅助脚本(文件验证器、工作流生成器)来简化用户操作。无论是新手还是经验丰富的用户,都可以通过该技能快速获得精确的命令建议、工作流模板和故障排除指南,从而高效地进行 NGS 数据分析。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/skills/deeptools

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

deepTools: NGS 数据分析工具包 是做什么的?

概述

deepTools 是一个全面的 Python 命令行工具套件,专为处理和分析高通量测序数据而设计。使用 deepTools 可以执行质量控制、数据标准化、样本比较,并为 ChIP-seq、RNA-seq、ATAC-seq、MNase-seq 等 NGS 实验生成出版级可视化结果。

核心功能:

  • 将 BAM 比对结果转换为标准化覆盖度轨迹(bigWig/bedGraph)
  • 质量评估(指纹图谱、相关性、覆盖度)
  • 样本比较与相关性分析
  • 在基因组特征周围生成热图和谱图
  • 富集分析和峰区可视化

何时使用此技能

此技能应在以下场景使用:

  • 文件转换:“将 BAM 转换为 bigWig”、“生成覆盖度轨迹”、“标准化 ChIP-seq 数据”
  • 质量控制:“检查 ChIP 质量”、“比较重复样本”、“评估测序深度”、“QC 分析”
  • 可视化:“在 TSS 周围创建热图”、“绘制 ChIP 信号”、“可视化富集”、“生成谱图”
  • 样本比较:“比较处理组与对照组”、“样本相关性分析”、“PCA 分析”
  • 分析工作流:“分析 ChIP-seq 数据”、“RNA-seq 覆盖度”、“ATAC-seq 分析”、“完整工作流”
  • 处理特定文件类型:基因组学背景下的 BAM 文件、bigWig 文件、BED 区域文件

快速入门

对于 deepTools 的新用户,请从文件验证和常见工作流开始:

1. 验证输入文件

在运行任何分析之前,使用验证脚本验证 BAM、bigWig 和 BED 文件:

python scripts/validate_files.py --bam sample1.bam sample2.bam --bed regions.bed

这会检查文件是否存在、BAM 索引以及格式正确性。

2. 生成工作流模板

对于标准分析,使用工作流生成器创建自定义脚本:

# 列出可用工作流
python scripts/workflow_generator.py --list

# 生成 ChIP-seq QC 工作流
python scripts/workflow_generator.py chipseq_qc -o qc_workflow.sh \
    --input-bam Input.bam --chip-bams "ChIP1.bam ChIP2.bam" \
    --genome-size 2913022398

# 添加执行权限并运行
chmod +x qc_workflow.sh
./qc_workflow.sh

3. 最常用操作

请参阅 assets/quick_reference.md 了解常用命令和参数。

安装

uv pip install deepTools==3.5.6

上游推荐使用 conda/bioconda 以获得完整的依赖解析,特别是在共享的 HPC 系统上:

conda install -c conda-forge -c bioconda deeptools

在 Apple Silicon 上,上游文档建议使用上述 PyPI 方法,或在本机 conda 包不可用时使用 osx-64 conda 环境。

核心工作流和工具类别

ChIP-seq QC、完整 ChIP-seq 分析、RNA-seq 覆盖度和 ATAC-seq 分析的完整命令序列,以及 BAM/bigWig 处理、质量控制和可视化工具类别,请见 references/core_workflows.md 和 references/workflows.md。每个工具的选项请见 references/tools_reference.md。

标准化方法

选择正确的标准化对于有效比较至关重要。请查阅 references/normalization_methods.md 获取全面指导。

快速选择指南:

  • ChIP-seq 覆盖度:使用 RPGC 或 CPM
  • ChIP-seq 比较:使用 bamCompare,带 log2 和 readCount
  • RNA-seq 分箱:使用 CPM
  • RNA-seq 基因:使用 RPKM(考虑基因长度)
  • ATAC-seq:使用 RPGC 或 CPM

标准化方法:

  • RPGC:1× 基因组覆盖度(需要 --effectiveGenomeSize)
  • CPM:每百万比对读段的计数
  • RPKM:每千碱基每百万读段的读段数(按分箱长度和文库大小缩放)
  • BPM:每百万分箱的计数,类似于 TPM 风格的分箱信号缩放
  • None:原始计数(不推荐用于比较)

完整说明:references/normalization_methods.md

有效基因组大小

RPGC 标准化需要有效基因组大小。常见值:

生物体组装大小用法
人类GRCh38/hg382,913,022,398--effectiveGenomeSize 2913022398
人类T2T/CHM13CAT_v23,117,292,070--effectiveGenomeSize 3117292070
小鼠GRCm39/mm392,654,621,783--effectiveGenomeSize 2654621783
小鼠GRCm38/mm102,652,783,500--effectiveGenomeSize 2652783500
斑马鱼GRCz111,368,780,147--effectiveGenomeSize 1368780147
果蝇dm6142,573,017--effectiveGenomeSize 142573017
秀丽隐杆线虫ce10/ce11100,286,401--effectiveGenomeSize 100286401

包含按读长长度分类的完整表格:references/effective_genome_sizes.md

跨工具通用参数

许多 deepTools 命令共享以下选项:

性能:

  • --numberOfProcessors, -p:启用并行处理(始终使用可用核心数)
  • max / max/2:--numberOfProcessors 支持的值;在调度器下很有用,因为最新的 deepTools 版本更谨慎地检测 CPU 亲和性
  • --region:处理特定区域以供测试(例如 chr1:1-1000000)

读段过滤:

  • --ignoreDuplicates:去除 PCR 重复(推荐用于大多数分析)
  • --minMappingQuality:按比对质量过滤(例如 --minMappingQuality 10)
  • --minFragmentLength / --maxFragmentLength:片段长度范围
  • --samFlagInclude / --samFlagExclude:SAM 标志过滤

读段处理:

  • --extendReads:扩展到片段长度(ChIP-seq:是,RNA-seq:否)
  • --centerReads:以片段中点为中心以获得更清晰的信号

最佳实践

文件验证

始终先验证文件,使用 scripts/validate_files.py 检查:

  • 文件是否存在且可读
  • BAM 索引是否存在(.bai 文件)
  • BED 格式是否正确
  • 文件大小是否合理

分析策略

  1. 从 QC 开始:在进行下一步之前,先运行相关性分析、覆盖度分析和指纹图谱分析
  2. 在小区域上测试:使用 --region chr1:1-10000000 进行参数测试
  3. 记录命令:保存完整的命令行以确保可重复性
  4. 使用一致的标准化:在样本比较中应用相同的方法
  5. 验证基因组组装:确保 BAM 和 BED 文件使用匹配的基因组版本

ChIP-seq 专用

  • 始终为 ChIP-seq 扩展读段:--extendReads 200
  • 去除重复:大多数情况下使用 --ignoreDuplicates
  • 首先检查富集:在详细分析之前先运行 plotFingerprint
  • GC 校正:仅在检测到显著偏差时应用;GC 校正后切勿使用 --ignoreDuplicates

RNA-seq 专用

  • 切勿为 RNA-seq 扩展读段(会跨越剪接连接点)
  • 链特异性:对常见的 dUTP 法链特异性文库使用 --filterRNAstrand forward/reverse;在解释链标签前确认文库方向
  • 标准化:分箱使用 CPM,基因使用 RPKM

ATAC-seq 专用

  • 应用 Tn5 校正:使用 alignmentSieve 和 --ATACshift
  • 仅对移位的正确配对使用:--ATACshift 等同于 --shift 4 -5 5 -4,并过滤为正确配对的片段
  • 片段过滤:设置合适的 min/max 片段长度
  • 检查核小体模式:片段大小图应显示阶梯模式

性能优化

  1. 使用多处理器:--numberOfProcessors 8(或可用核心数)
  2. 增加分箱大小以加快处理速度并减小文件大小
  3. 对内存有限的系统,单独处理染色体
  4. 使用 alignmentSieve 预过滤 BAM 文件以创建可重复使用的过滤文件
  5. 使用 bigWig 而非 bedGraph:压缩且处理速度更快

故障排除

常见问题

BAM 索引缺失:

samtools index input.bam

内存不足: 使用 --region 单独处理染色体:

bamCoverage --bam input.bam -o chr1.bw --region chr1

处理缓慢: 增加 --numberOfProcessors 和/或增加 --binSize

bigWig 文件过大: 增加分箱大小:--binSize 50 或更大

验证错误

运行验证脚本以识别问题:

python scripts/validate_files.py --bam *.bam --bed regions.bed

脚本输出中解释了常见错误及其解决方案。

参考文档

此技能包含全面的参考文档:

references/tools_reference.md

按类别组织的所有 deepTools 命令的完整文档:

  • BAM 和 bigWig 处理工具(9 个工具)
  • 质量控制工具(6 个工具)
  • 可视化工具(3 个工具)
  • 其他工具(3 个工具,包括 bigwigAverage)

每个工具包括:

  • 用途和概述
  • 关键参数及说明
  • 使用示例
  • 重要说明和最佳实践

当用户询问特定工具、参数或详细用法时使用此参考。

references/workflows.md

常见分析的完整工作流示例:

  • ChIP-seq 质量控制工作流
  • ChIP-seq 完整分析工作流
  • RNA-seq 覆盖度工作流
  • ATAC-seq 分析工作流
  • 多样本比较工作流
  • 峰区分析工作流
  • 故障排除和性能提示

当用户需要完整的分析流程或工作流示例时使用此参考。

references/normalization_methods.md

标准化方法的全面指南:

  • 每种方法的详细说明(RPGC、CPM、RPKM、BPM 等)
  • 何时使用每种方法
  • 公式和解释
  • 按实验类型选择指南
  • 常见陷阱及解决方案
  • 快速参考表

当用户询问标准化、样本比较或选择哪种方法时使用此参考。

references/effective_genome_sizes.md

有效基因组大小值及用法:

  • 常见生物体值(人类、小鼠、果蝇、线虫、斑马鱼)
  • 按读长长度分类的值
  • 计算方法
  • 何时以及如何在命令中使用
  • 自定义基因组计算说明

当用户需要 RPGC 标准化或 GC 偏差校正的基因组大小时使用此参考。

辅助脚本

scripts/validate_files.py

验证 BAM、bigWig 和 BED 文件以供 deepTools 分析。检查文件存在性、索引和格式。

用法:

python scripts/validate_files.py --bam sample1.bam sample2.bam \
    --bed peaks.bed --bigwig signal.bw

**何时使用:**在任何分析开始之前,或排查错误时。

scripts/workflow_generator.py

为常见 deepTools 工作流生成可自定义的 bash 脚本模板。

可用工作流:

  • chipseq_qc:ChIP-seq 质量控制
  • chipseq_analysis:完整的 ChIP-seq 分析
  • rnaseq_coverage:链特异性 RNA-seq 覆盖度
  • atacseq:含 Tn5 校正的 ATAC-seq

用法:

# 列出工作流
python scripts/workflow_generator.py --list

# 生成工作流
python scripts/workflow_generator.py chipseq_qc -o qc.sh \
    --input-bam Input.bam --chip-bams "ChIP1.bam ChIP2.bam" \
    --genome-size 2913022398 --threads 8

# 运行生成的工作流
chmod +x qc.sh
./qc.sh

**何时使用:**用户请求标准工作流或需要自定义的模板脚本。

资源

assets/quick_reference.md

包含最常用命令、有效基因组大小和典型工作流模式的快速参考卡。

**何时使用:**用户需要快速命令示例,无需详细文档。

处理用户请求

针对新用户

  1. 从验证安装开始
  2. 使用 scripts/validate_files.py 验证输入文件
  3. 根据实验类型推荐适当的工作流
  4. 使用 scripts/workflow_generator.py 生成工作流模板
  5. 指导自定义和执行

针对有经验的用户

  1. 为请求的操作提供特定工具命令
  2. 引用 references/tools_reference.md 中的相应部分
  3. 提供优化和最佳实践建议
  4. 为问题提供故障排除

针对特定任务

“将 BAM 转换为 bigWig”:

  • 使用 bamCoverage 并指定适当的标准化方法
  • 根据用例推荐 RPGC 或 CPM
  • 提供生物体的有效基因组大小
  • 建议相关参数(extendReads、ignoreDuplicates、binSize)

“检查 ChIP 质量”:

  • 运行完整的 QC 工作流或专门使用 plotFingerprint
  • 解释结果的含义
  • 根据结果建议后续操作

“创建热图”:

  • 引导完成两步过程:computeMatrix → plotHeatmap
  • 帮助选择合适的矩阵模式(reference-point 对比 scale-regions)
  • 建议可视化参数和聚类选项

“比较样本”:

  • 推荐使用 bamCompare 进行两个样本比较
  • 建议使用 multiBamSummary + plotCorrelation 进行多个样本比较
  • 指导标准化方法的选择

引用文档

当用户需要详细信息时:

  • 工具详情:指向 references/tools_reference.md 中的特定部分
  • 工作流:使用 references/workflows.md 中的完整分析流程
  • 标准化:查阅 references/normalization_methods.md 以选择方法
  • 基因组大小:参考 references/effective_genome_sizes.md

示例交互

用户:“我需要分析我的 ChIP-seq 数据”

回复思路:

  1. 询问可用文件(BAM 文件、峰区、基因)
  2. 使用验证脚本验证文件
  3. 生成 chipseq_analysis 工作流模板
  4. 根据其特定文件和生物体进行自定义
  5. 在脚本运行时解释每一步

用户:“我应该使用哪种标准化方法?”

回复思路:

  1. 询问实验类型(ChIP-seq、RNA-seq 等)
  2. 询问比较目标(样本内或样本间)
  3. 查阅 references/normalization_methods.md 选择指南
  4. 推荐适当的方法并说明理由
  5. 提供带有参数的命令示例

用户:“在 TSS 周围创建一个热图”

回复思路:

  1. 验证 bigWig 和注释文件的存在性
  2. 为 computeMatrix 选择合适的模式(reference-point)
  3. 建议影响分辨率的关键参数(missingDataAsZero、sortRegions)
  4. 提供带有参考点模式的 computeMatrix 命令行
  5. 为 plotHeatmap 建议可视化参数(颜色映射、聚类)

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

adaptyv

How to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.

aeon

This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.

alphagenome

Look up precomputed AlphaGenome Atlas effects for any GRCh38 single-nucleotide variant (AVI score with Phred and 18 SHAP feature attributions, plus raw and quantile scores for RNA-seq, DNase, ATAC, ChIP-TF, ChIP-histone, CAGE, PRO-cap, splicing, polyadenylation and contact-map tracks), score variants or scan windows on demand with the AlphaGenome model for human and mouse (variant scoring, in silico mutagenesis, REF-versus-ALT track prediction), and build Atlas website deep links. Use when the user mentions AlphaGenome, AlphaGenome Atlas, AVI or AlphaGenome Variant Impact, DeepMind variant effect prediction, or wants to prioritise or mechanistically interpret non-coding, regulatory, splicing, enhancer, promoter, or chromatin-accessibility effects of SNVs from a VCF, credible set, or region. Research use only; not a clinical tool.

analytical-method-validation

Plan, execute, and document validation, verification, and transfer of analytical procedures under the governing framework - ICH Q2(R2) and Q14, USP <1220>/<1225>/<1226>, ICH M10 bioanalytical, CLSI EP, or ISO/IEC 17025. Use for HPLC, LC-MS/MS, GC, CE, ICP-MS, dissolution, qNMR, qPCR, NIR, and ligand binding or cell-based assays whenever the question is whether a procedure is fit for its intended purpose. Triggers include

anndata

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

arbor

Autonomously improve a real artifact (code, training recipe, agent harness, data pipeline, prompt) against an objective and an evaluator, using Hypothesis Tree Refinement (HTR) from the Arbor paper. Use this whenever someone wants to iteratively optimize something over many experiments without overfitting — e.g.

arboreto

Infer gene regulatory networks (GRNs) from gene expression data using scalable algorithms (GRNBoost2, GENIE3). Use when analyzing transcriptomics data (bulk RNA-seq, single-cell RNA-seq) to identify transcription factor-target gene relationships and regulatory interactions. Supports distributed computation for large-scale datasets.

astropy

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

autoskill

Observe the user

benchling-integration

Benchling Python SDK and REST API integration for registry entities, inventory, ELN entries, workflows, Benchling Apps, and Data Warehouse queries. Use when automating lab data with benchling-sdk or the v2 API.

bgpt-paper-search

Search scientific papers and retrieve structured experimental data extracted from full-text studies via the BGPT MCP server. Returns 25+ fields per paper including methods, results, sample sizes, quality scores, and conclusions. Use for literature reviews, evidence synthesis, and finding experimental details not available in abstracts alone.

bids

>

biopython

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

bioservices

Unified Python interface to 40+ bioinformatics services. Use when querying multiple databases (UniProt, KEGG, ChEMBL, Reactome) in a single workflow with consistent API. Best for cross-database analysis, ID mapping across services. For quick single-database lookups use gget; for sequence/file manipulation use biopython.

bulk-rnaseq

End-to-end bulk RNA-seq orchestrator — takes raw FASTQ reads through QC and trimming (FastQC, fastp/Trim Galore), alignment and quantification (STAR, Salmon, featureCounts), assembles a gene-level counts matrix, then hands off to differential expression (pydeseq2), pathway/GSEA enrichment (pathway-enrichment), and publication figures (scientific-visualization). Use whenever the user has bulk RNA-seq reads or quant output and wants a complete, reproducible differential-expression workflow — e.g.

cellxgene-census

Query the CZ CELLxGENE Census programmatically for versioned public single-cell and spatial transcriptomics data. Use when you need population-scale cell metadata, gene expression slices, Census summary counts, source H5AD URIs/downloads, embeddings, spatial Census data, or reference atlas comparisons across organisms, tissues, diseases, assays, and cell types. For analyzing your own local single-cell data use scanpy, anndata, or scvi-tools.

cirq

Google quantum computing framework. Use when targeting Google Quantum AI hardware, designing noise-aware circuits, or running quantum characterization experiments. Best for Google hardware, noise modeling, and low-level circuit design. For IBM hardware use qiskit; for quantum ML with autodiff use pennylane; for physics simulations use qutip.

citation-management

Comprehensive citation management for academic research. Search OpenAlex, PubMed, and Google Scholar for papers, extract accurate metadata, validate citations, and generate properly formatted BibTeX entries. This skill should be used when you need to find papers, verify citation information, convert DOIs to BibTeX, or ensure reference accuracy in scientific writing.

clinical-decision-support

Prepare and validate research-only clinical decision-support evaluation, evidence-profile, cohort, survival, biomarker/model, privacy, and governance artifacts. Use for aggregate or synthetic research documentation and traceability—not patient care or live clinical operation.

clinical-reports

Create safety-bounded draft structures and run local deterministic checks for clinical case, diagnostic, trial, safety, and aggregate research reports. Use only with synthetic, de-identified, or aggregate inputs and verified source-fact manifests; every output requires qualified review.

相关技能