bx-python question about bed_intersect_basewise.py
Sorry, Galaxy I hit sent by accident in my earlier message. Like I said, I had a question about bed_intersect_basewise.py My first bed file has the following interval: chr22 267 572 and my second bed file has the intervals: chr22 147 267 chr22 267 387 chr22 387 507 chr22 507 627 When I run the program, I get the answer chr22 202 572 But I'm trying to see if there is a way I can get the complement, bases in the second file that don't overlap the first. The desired answer would be: chr22 147 267 chr22 572 627 I know there is a -v option on bed_intersect.py, but I want the equivalent basewise behavior. I was trying to poke around the BinnedBitSet code, and I see there is an invert method, but calling the invert method has some side effects on the rest of the code (either the next_set or next_clear call), and I get a run-time error. The BinnedBitSet code somewhat of a blackbox to me, but I'd appreciate any pointers in the right direction. Thanks for your help, Amit Indap -- Amit Indap
Excerpts from Amit Indap's message of Tue Dec 07 04:10:09 +0000 2010:
But I'm trying to see if there is a way I can get the complement, bases in the second file that don't overlap the first. The desired answer would be: chr22 147 267 chr22 572 627
bed_complement.py is the key here. There are multiple ways to get the desired result, but here is one: bed_complement.py 1.bed <(echo "chr22 1000") | bed_intersect_basewise.py /dev/stdin 2.bed bed_complement.py needs a LEN file, here I just make a fake one on the fly, you will probably want to use a real one, although for this particular case, it doesn't matter as long as the lengths are larger than any end position in the second file. (In Galaxy, this is 'complement' followed by 'intersect' with overlapping pieces, LEN files are handled automagically). -- James Taylor, Assistant Professor, Biology / Computer Science, Emory University
participants (2)
-
Amit Indap
-
James Taylor