arq5x/bedtools2 — pull request #135 by brentp (2014-10-28 17:53:21+00:00)
Title: initial go at -exclude for fisher

@arq5x and @nkindlon before I go any further down this rabbit hole, I wanted to get your input.

obviously, the fisher stuff will be most useful if we can apply -include and/or -exclude as in shuffleBed. Currently, this PR is a start at -exclude using loadBedIntoMap. Right now, it only shortens the genome length and doesn't exclude anything in -a or -b. I wanted to get your input on how to do that.

Given this input:

```Shell
$ cat a.bed
chr1	10	20
chr1	30	40

$ cat b.bed
chr1	15	25

$ cat t.genome
chr1	500

$ cat ex.bed
chr1	50	500
chr1	200	500

$ cat ex2.bed
chr1 35 500
```

The usage is:

```Shell

$ ./bin/bedtools fisher -a a.bed -b b.bed -g t.genome
# Contingency Table
#_________________________________________
# | not in -b | in -b |
# not in -a | 475 | 5 |
# in -a | 15 | 5 |
#_________________________________________
# p-values for fisher's exact test
left	right	two-tail	ratio
1	1.3466e-05	1.3466e-05	31.667

$ ./bin/bedtools fisher -a a.bed -b b.bed -g t.genome -exclude ex.bed
# Contingency Table
#_________________________________________
# | not in -b | in -b |
# not in -a | 25 | 5 |
# in -a | 15 | 5 |
#_________________________________________
# p-values for fisher's exact test
left	right	two-tail	ratio
0.86011	0.35497	0.49401	1.667

```

and that works as it should excluding bases from 50 to 500 from the upper-left corner of the contingency table. However, if I would like to address the case where `ex2.bed` overlaps `a.bed` in the interval chr1:35-40--currently the counts from `a.bed` would be unadjusted.

What is the best way to do this? Should I be using the `loadIntoMap()` or is there a way to do this with the `sweep` machinery? Initially, I thought that I could complement -exclude into -include and add that as an additional -b to sweep, but it wasn't clear if that would work.

thanks for any pointers.