DELLY2 — 多证据整合的结构变异检测工具¶
一句话说明¶
DELLY2(v1.7.x)同时利用配对末端读段和分裂读段两种信息检测结构变异——就像用两组侦探同时调查同一案件,交叉验证提高准确性,支持短读和长读数据。
安装与配置¶
# 方法1:conda安装(推荐)
conda create -n delly python=3.9
conda activate delly
conda install -c bioconda delly # 安装最新版DELLY(v1.7.x)
# 验证安装
delly --version # 查看版本号
# 方法2:下载预编译静态二进制(最简单,无依赖)
wget https://github.com/dellytools/delly/releases/download/v1.7.2/delly_v1.7.2_linux_x86_64bit
chmod +x delly_v1.7.2_linux_x86_64bit
./delly_v1.7.2_linux_x86_64bit --version
# 方法3:Docker运行
docker pull dellytools/delly:latest
# 设置并行线程数(DELLY使用OpenMP并行)
export OMP_NUM_THREADS=16 # 使用16个CPU线程
核心用法¶
基本SV检测(单样本)¶
# 检测所有类型SV(-t ALL或分别指定类型)
delly call \
-g reference.fasta \ # 参考基因组
-o delly_sv.bcf \ # 输出BCF文件(比VCF快)
sample.bam # 输入BAM(必须有索引)
# 转换BCF为VCF
bcftools view delly_sv.bcf -o delly_sv.vcf.gz -O z
tabix -p vcf delly_sv.vcf.gz # 建立索引
指定SV类型检测¶
# -t参数指定SV类型:DEL/DUP/INV/BND/INS
delly call -t DEL -g reference.fasta -o deletions.bcf sample.bam # 仅检测缺失
delly call -t DUP -g reference.fasta -o duplications.bcf sample.bam # 仅检测重复
delly call -t INV -g reference.fasta -o inversions.bcf sample.bam # 仅检测倒位
delly call -t BND -g reference.fasta -o translocations.bcf sample.bam # 易位
delly call -t INS -g reference.fasta -o insertions.bcf sample.bam # 插入
群体/多样本联合基因分型¶
# 第一步:对每个样本单独检测SV
delly call -g reference.fasta -o sample1.bcf sample1.bam
delly call -g reference.fasta -o sample2.bcf sample2.bam
delly call -g reference.fasta -o sample3.bcf sample3.bam
# 第二步:合并所有样本的SV位点
delly merge \
-o merged_sv.bcf \
sample1.bcf sample2.bcf sample3.bcf # 合并多个BCF
# 第三步:对所有样本重新基因分型(联合分型)
delly genotype \
-g reference.fasta \
-v merged_sv.bcf \ # 合并后的SV位点
-o sample1_genotyped.bcf \
sample1.bam # 对每个样本分别运行
# 第四步:合并基因分型结果
bcftools merge -m id \
-O b -o cohort_sv.bcf \
sample1_genotyped.bcf sample2_genotyped.bcf sample3_genotyped.bcf
体细胞SV检测(肿瘤-正常配对)¶
# 配对模式(-t DEL检测缺失,其他类型类似)
delly call \
-t DEL \
-g reference.fasta \
-o somatic_del.bcf \
tumor.bam normal.bam # 肿瘤在前,正常在后
# 体细胞过滤(需要样本tsv文件)
# 创建samples.tsv:每行格式为 sample_name\ttumor/control
echo -e "TUMOR\ttumor\nNORMAL\tcontrol" > samples.tsv
delly filter \
-f somatic \ # 体细胞过滤模式
-o somatic_del_filtered.bcf \
-s samples.tsv \ # 样本信息文件
somatic_del.bcf
参数详解¶
| 参数 | 说明 | 示例值 |
|---|---|---|
-g | 参考基因组FASTA(需.fai索引) | reference.fasta |
-t | SV类型 | DEL、DUP、INV、BND、INS |
-o | 输出BCF/VCF文件 | output.bcf |
-q | 最低mapping quality | 20(默认) |
-s | 最小SV大小(bp) | 300(短读默认) |
-x | 排除区域BED文件 | delly.excl.hg38.tsv |
-f | 过滤模式 | germline、somatic |
实战案例¶
# 群体SV分析流程(3个样本的完整流程)
REF="hg38.fasta"
# 排除低可图性区域(DELLY官方提供,推荐使用)
EXCL="human.hg38.excl.tsv"
export OMP_NUM_THREADS=16
# 1. 单样本SV检测
for bam in sample1.bam sample2.bam sample3.bam; do
prefix="${bam%.bam}"
delly call -g $REF -x $EXCL -o ${prefix}.bcf $bam
bcftools index ${prefix}.bcf # 建索引
done
# 2. 合并SV位点
delly merge -o merged.bcf sample1.bcf sample2.bcf sample3.bcf
# 3. 对每个样本重新基因分型
for bam in sample1.bam sample2.bam sample3.bam; do
prefix="${bam%.bam}"
delly genotype -g $REF -v merged.bcf \
-o ${prefix}_geno.bcf $bam
bcftools index ${prefix}_geno.bcf
done
# 4. 合并基因分型BCF
bcftools merge -m id -O b -o cohort.bcf \
sample1_geno.bcf sample2_geno.bcf sample3_geno.bcf
bcftools index cohort.bcf
# 5. 胚系过滤
delly filter -f germline -o cohort_filtered.bcf cohort.bcf
# 6. 转VCF并统计
bcftools view cohort_filtered.bcf | grep -v "^#" | \
awk '{print $5}' | grep -oP "<\K[^>]+" | sort | uniq -c
常见报错与解决¶
报错1:Abort: DELLY requires a sequence dictionary - 原因:参考基因组缺少.fai索引 - 解决:samtools faidx reference.fasta
报错2:ERROR: Not enough reads to estimate library statistics - 原因:输入BAM测序深度太低或样本太小 - 解决:确认BAM文件是否正确;用samtools flagstat检查总reads数(至少需要数百万reads)
报错3:检测结果与Manta差异很大 - 原因:DELLY和Manta使用不同算法,结果差异正常 - 解决:可用SURVIVOR合并两个工具结果取交集,提高置信度:SURVIVOR merge vcf_list.txt 1000 2 1 1 0 50 merged.vcf
速查表¶
| 命令 | 说明 |
|---|---|
delly call -g ref.fa -o out.bcf sample.bam | 基本SV检测 |
delly call -t DEL | 仅检测缺失 |
delly call -t DUP | 仅检测重复 |
delly call -t INV | 仅检测倒位 |
delly call -t BND | 仅检测易位断点 |
delly merge | 合并多样本SV位点 |
delly genotype -v merged.bcf | 多样本联合基因分型 |
delly filter -f somatic | 体细胞SV过滤 |
delly filter -f germline | 胚系SV过滤 |
export OMP_NUM_THREADS=16 | 设置并行线程数 |
-x delly.excl.hg38.tsv | 排除低可图区域(推荐) |