跳转至

Inspector — 长读长de novo组装质量评估工具


一句话说明

Inspector 不需要参考基因组,直接用原始长读长数据评估组装质量——就像用"原材料重新检验成品",精确找出组装中的碱基错误和结构错误位置。


安装与配置

# 方法1:conda安装(推荐)
conda create -n inspector python=3.8    # 创建Python环境
conda activate inspector

conda install -c bioconda inspector     # 安装Inspector
conda install -c bioconda minimap2      # Inspector依赖minimap2做比对

# 方法2:源码安装(来自ChongLab维护的最新版)
git clone https://github.com/ChongLab/Inspector
cd Inspector
pip install -r requirements.txt          # 安装Python依赖

# 验证安装
inspector.py --version    # 查看版本(最新更新2024年8月)
inspector.py --help       # 查看帮助

核心用法

基本评估命令

# 无参考基因组模式(最常用)
inspector.py \
    -c assembly.fasta \        # 待评估的组装contig文件
    -r reads.fastq.gz \        # 用于评估的原始长读长
    -o inspector_output \      # 输出目录
    --datatype nanopore        # 数据类型:nanopore 或 pacbio-raw 或 pacbio-hifi

# 有参考基因组模式(可获得额外对比信息)
inspector.py \
    -c assembly.fasta \
    -r reads.fastq.gz \
    -o inspector_output \
    --ref reference.fasta \    # 参考基因组(可选)
    --datatype pacbio-hifi     # HiFi数据

组装错误校正

# 运行Inspector后,可以对发现的错误进行校正
inspector-correct.py \
    -i inspector_output \      # Inspector输出目录
    --datatype nanopore \      # 数据类型
    -o corrected_assembly/     # 校正后的输出目录

参数详解

参数说明示例值
-c组装contig FASTA文件assembly.fasta
-r长读长原始数据(支持多个文件)reads1.fq reads2.fq
-o输出目录inspector_out/
--datatype数据类型nanoporepacbio-rawpacbio-hifi
--ref参考基因组(可选)reference.fasta
-l最小contig长度过滤10000(默认,单位bp)
-t线程数16
--min_cov最低覆盖度要求4(默认)

实战案例

# 评估ONT组装结果(以Flye组装为例)

# 1. 准备数据
ASSEMBLY="flye_output/assembly.fasta"     # Flye输出的组装
READS="ont_reads.fastq.gz"               # 原始ONT reads

# 2. 运行Inspector(无参考,参数-t设置线程数)
inspector.py \
    -c $ASSEMBLY \
    -r $READS \
    -o inspector_results \
    --datatype nanopore \
    -t 24 \
    -l 10000          # 仅评估长于10kb的contig

# 3. 查看评估报告
cat inspector_results/summary_statistics  
# 关注指标:
# - QV (Quality Value):越高越好,>40表示99.99%准确率
# - Read mapping rate:reads比对率,越高越好
# - Structural errors:结构错误数量(展开、坍缩、单倍型切换等)
# - Small-scale errors:小错误数量(碱基替换、小插入/缺失)

# 4. 查看具体错误位置
cat inspector_results/structural_errors.bed   # 结构错误坐标
cat inspector_results/small_scale_errors.bed  # 小错误坐标

# 5. 可选:基于Inspector结果进行错误校正
inspector-correct.py \
    -i inspector_results \
    --datatype nanopore \
    -o corrected/ \
    -t 24

常见报错与解决

报错1:minimap2: command not found - 原因:minimap2未安装或不在PATH中 - 解决:conda install -c bioconda minimap2 或检查环境which minimap2

报错2:No contigs passed the length filter - 原因:所有contig均短于-l设置的阈值(默认10000bp) - 解决:降低阈值-l 1000或检查组装是否成功grep -c ">" assembly.fasta

报错3:QV值极低(<20) - 原因:组装质量差,或reads与组装不匹配(用错了reads) - 解决:确认reads和组装来自同一样本;检查比对率,低于50%需排查问题


速查表

命令/概念说明
--datatype nanoporeONT数据类型
--datatype pacbio-hifiPacBio HiFi数据类型
--datatype pacbio-rawPacBio CLR数据类型
summary_statistics主要评估报告文件
structural_errors.bed大错误坐标(≥50bp)
small_scale_errors.bed小错误坐标(<50bp)
QV > 40高质量组装标准(99.99%准确率)
QV > 30可接受质量(99.9%准确率)
inspector-correct.py基于错误报告校正组装