This is a test version of Biostars. For the public version, visit https://www.biostars.org.
What Is The Best Library For Handling Interval Logic?

What libraries are there for handling logic on intervals? I really want all the set operations on the intervals at genome scale. Bonus points if it has some persistence mechanism and can track the ancestor of an operation (i.e. interval X is the result of the intersection of Y and Z).

I looked at bx python, but the documentation is not great.

library

3 answers

Have you tried the bioconductor packages IRanges or GenomicRanges. I have used IRanges earlier for a similar task as suggested by Jeremy.

Looks pretty good, but how does persistence work with the ranges, or do you need to manually convert each time?

I don't think the IRanges objects track their own derivation history.

@Casbon: +1 David. Not sure about the persistence mechanism.

you can save an IRanges object using... save() Thumbs up for the most advanced interval library at present.

Ryan Dale recently released a Python wrapper for BEDtools called pybedtools. BEDTools supports all common genome arithmetic (intersect, merge, complement, join, subtract, etc.) and the Python wrapper would make it relatively simple for you to define a derivation history for the result of each operation.

I am partial to https://github.com/biocore-ntnu/pyranges

Log in to answer this question.