Skip to content
Andy Pohl edited this page Oct 29, 2013 · 7 revisions

The remove program is slightly more complex than that of fill, which does the opposite operation. There are two main ways of removing data: (1) threshold the data itself, or (2) select directly parts of the genome to remove using a bed file. This program allows several ways to numerically select data but it should be noted that removal of data equal to a floating-point number is by nature a bit problematic. See an explanation here. For this reason, thresholding is only done using < or >, rather than ≤, ≥, =, or ≠. The usage of remove is:

bwtool - Data operations on bigWig files
usage:
   bwtool remove <operator> <value|mask.bed> input.bw[:chr:start-end] output.bw
where:
   operator is one of the following: "less", "more", or "mask".  In the case
   of "mask", the next parameter is a bed file containing the regions to remove.
   If the operator is not "mask", it is a typical binary operator for a thresholding
   operation using the value parameter.
options:
   -inverse   remove the data NOT specified in the operation

Examples

The example from aggregate:

Removing everything below 4 gives us:

$ bwtool remove less 4 main.bigWig removed.bigWig 
$ bigWigToWig removed.bigWig /dev/stdout
fixedStep chrom=chr start=3 step=1 span=1
5
6
5
fixedStep chrom=chr start=8 step=1 span=1
5
5
5
6
6
fixedStep chrom=chr start=17 step=1 span=1
10
4
4
fixedStep chrom=chr start=30 step=1 span=1
4
6
6
4
4
4

To demonstrate the masking capability, we can use the bed file seen above in the picture, again from the aggregate example.

$ bwtool remove mask agg1.bed main.bigWig removed.bigWig
$ bigWigToWig removed.bigWig /dev/stdout
fixedStep chrom=chr start=5 step=1 span=1
5
3
3
5
5
fixedStep chrom=chr start=20 step=1 span=1
2
2
2
1
fixedStep chrom=chr start=28 step=1 span=1
2
fixedStep chrom=chr start=36 step=1 span=1
2

Finally, it's possible to remove the opposite of what we just removed, i.e. keep the bases covered by the bed regions by using the -inverse option like:

$ bwtool remove mask agg1.bed main.bigWig removed.bigWig -inverse
$ bigWigToWig removed.bigWig /dev/stdout
fixedStep chrom=chr start=1 step=1 span=1
1
2
5
6
fixedStep chrom=chr start=10 step=1 span=1
5
6
6
0
2
3
3
10
4
4
fixedStep chrom=chr start=29 step=1 span=1
3
4
6
6
4
4
4
Clone this wiki locally