bioframe icon indicating copy to clipboard operation
bioframe copied to clipboard

improve documentation for overlap "return_overlap" argument

Open gonzalobenegas opened this issue 3 years ago • 3 comments

Hello,

Thanks for your awesome library. I'm trying to do basepair-level intersection. As I didn't find it in the documentation, I've been doing the following:

In [42]: a
Out[42]: 
  chrom  start  end     name
0     1     10   13  1:10-13
1     1     14   17  1:14-17

In [43]: b
Out[43]: 
  chrom  start  end
0     1     15   25
1     1     30   40

In [44]: bf.subtract(a, bf.complement(b, a)).drop(columns="name")
Out[44]: 
  chrom  start  end
0     1     15   17

Does it make sense? Is there a better approach?

Best, Gonzalo

gonzalobenegas avatar Sep 28 '22 20:09 gonzalobenegas

Hi Gonzalo, Thanks for the kind words! Would overlap() with how='left', return_overlap=True return what you were looking for? Let us know if there's any specific places in the docs where it would have been helpful to mention this return argument! (e.g. in https://bioframe.readthedocs.io/en/latest/guide-intervalops.html#overlap or in https://bioframe.readthedocs.io/en/latest/guide-recipes.html)

gfudenberg avatar Sep 28 '22 21:09 gfudenberg

Thank you, that does return what I was looking for!

Maybe a visualization in https://bioframe.readthedocs.io/en/latest/guide-intervalops.html#overlap could help (though I might be biased from my previous experience with bedtools intersect).

gonzalobenegas avatar Sep 28 '22 22:09 gonzalobenegas

ok! I'll re-open this as an issue for improving documentation

gfudenberg avatar Sep 28 '22 22:09 gfudenberg