纠正错误 / Fix 添加实例 / Add example
文件格式 / Formats

bedtools

对 BED/GFF/GTF/VCF/BAM 等基因组区间做交集、覆盖度、最近邻和格式转换。Genome arithmetic toolkit for intersections, coverage, closest features, and format conversion.

速览 | Quick Look

安装 | Install

mamba install -c bioconda bedtools

常用命令 | Common Commands

求两个区间文件交集:

bedtools intersect -a peaks.bed -b promoters.bed > peaks.in_promoters.bed

保留 A 中所有记录,并标注是否命中 B:

bedtools intersect -a variants.bed -b genes.bed -loj > variants.with_genes.tsv

计算每个区间覆盖度:

bedtools coverage -a targets.bed -b sample.bam > target_coverage.tsv

BAM 转 BED:

bedtools bamtobed -i alignments.bam > alignments.bed

生成 genome coverage:

bedtools genomecov -ibam sample.bam -bg > sample.bedgraph

关键参数 | Key Options

常见坑 | Pitfalls

参考 | References