Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A method for getting length of the overlap between two loci #260

Open
integratebio opened this issue Nov 21, 2021 · 0 comments
Open

A method for getting length of the overlap between two loci #260

integratebio opened this issue Nov 21, 2021 · 0 comments

Comments

@integratebio
Copy link

integratebio commented Nov 21, 2021

Hello developers,
This is a feature request. I feel that it would have been very helpful if the Locus object had a method that would calculate the length of the overlap with another locus. For doing this, most of the time, I have to rely on Pyranges or rarely on a quick but rather rusty method (converting loci to ranges and then to sets and then calculating the length of the intersection between the sets). I always felt that if I could do these operations using pyensembl that would simplify overlap analysis so much.

For example, if there are two loci:

l1=Locus(contig='17', start=78852977, end=78925387, strand='-')
l2=Locus(contig='17', start=7552977, end=78905387, strand='-')

There could be a method that allows the calculation of the length of the overlap. The syntax could be something like

l1.overlap_length(l2) 
# returns the length of the overlap

Additionally, there could be simple methods to get the length of a locus (l1.length), and then that could be used to calculate the fraction of the length of a locus that is overlapping (the syntax could be something like l1.overlap_length_fraction(l2)).

I hope these simple add-ons which I feel are essential would be integrated into pyensembl at some point in time. 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant