基本概述:
bedtools subtract 通俗的说,得到 A - B 的区段。如果在A中发现了B区段,就把 B 扣除,通过不同的参数,扣除的标准不一样。其中,参数 -A 可以达成 Remove features with any overlap 的效果(第四行)。
使用方法:
bedtools subtract [OPTIONS] -a <BED/GFF/VCF> -b <BED/GFF/VCF>
或者简写成
subtractBed [OPTIONS] -a <BED/GFF/VCF> -b <BED/GFF/VCF>
参数一览
Option Description
-f Minimum overlap required as a fraction of A. Default is 1E-9 (i.e. 1bp).
-F Minimum overlap required as a fraction of B. Default is 1E-9 (i.e., 1bp).
-r Require that the fraction of overlap be reciprocal for A and B. In other words, if -f is 0.90 and -r is used, this requires that B overlap at least 90% of A and that A also overlaps at least 90% of B.
-e Require that the minimum fraction be satisfied for A _OR_ B. In other words, if -e is used with -f 0.90 and -F 0.10 this requires that either 90% of A is covered OR 10% of B is covered. Without -e, both fractions would have to be satisfied.
-s Force “strandedness”. That is, only report hits in B that overlap A on the same strand. By default, overlaps are reported without respect to strand.
-S Require different strandedness. That is, only report hits in B that overlap A on the _opposite_ strand. By default, overlaps are reported without respect to strand.
-A Remove entire feature if any overlap. That is, by default, only subtract the portion of A that overlaps B. Here, if any overlap is found (or -f amount), the entire feature is removed.
-N Same as -A except when used with -f, the amount is the sum of all features (not any single feature).
默认参数:
$ cat A.bed
chr1 10 20
chr1 100 200$ cat B.bed
chr1 0 30
chr1 180 300$ bedtools subtract -a A.bed -b B.bed
chr1 100 180
A 10 - 20 100 - 200
B 0-30 180-300
默认状态 A 第一个区段全扣除,第二个区段180之后的序列扣除,最终剩下100-180.
-f 重叠参数
$ cat A.bed
chr1 100 200$ cat B.bed
chr1 180 300$ bedtools subtract -a A.bed -b B.bed -f 0.10
chr1 100 180$ bedtools subtract -a A.bed -b B.bed -f 0.80
chr1 100 200
f 这个参数,如果B的区段覆盖度不满足这个参数,就不被扣除。0.10 扣了,0.80 没扣。
-s 考虑特征(正反链)
$ cat A.bed
chr1 100 200 a1 1 +$ cat B.bed
chr1 80 120 b1 1 +
chr1 180 300 b2 1 -$ bedtools subtract -a A.bed -b B.bed -S
chr1 100 180 a1 1 +
-A Remove features with any overlap:
重点来了,-A 模式下,那么 B 里面包含 A 里 包含一个 1个BP,也是整段删除。“”沾边删” 模式
$ cat A.bed
chr1 100 200$ cat B.bed
chr1 180 300$ bedtools subtract -a A.bed -b B.bed
chr1 100 180$ bedtools subtract -a A.bed -b B.bed -A