As part of a larger analysis, I need to evaluate pairs of genomic regions (
regionsB) and perform different calculations for each pair depending on whether:
- They're completely separate (no overlap)
regionsA(start or end of
regionsBdoes not overlap; both are handled separately)
regionsBis fully contained in
At this time,
regionsB are represented as Pandas DataFrames. Likewise, I'm doing all possible combinations:
if (region_b.start < region_a.start and region_b.end < region_b.start): [...] elif (region_b.start < region_a.start and (region_b.end > region_a.start and region_b.end < region_a.end )):
Given that there are many conditions I check for, this makes the code long, a little hard to read, and too verbose. Is there anything I can use (without making the code harder to read) to make these checks simpler, something like PyRanges (or PyRanges itself, although I don't think there's API for it)?
If not, I'll just live with what I have.