Skip to content

Skip overlap checks for singleton chromosomes in is_viewframe - #245

Open
DylanCosto wants to merge 1 commit into
open2c:mainfrom
DylanCosto:perf-view-singletons
Open

DylanCosto wants to merge 1 commit into
open2c:mainfrom
DylanCosto:perf-view-singletons

Conversation

@DylanCosto

Copy link
Copy Markdown

is_viewframe runs is_overlapping on the whole frame. When a view has many single-interval "chromosomes", for example a view built from reads as in #114, that check dominates: make_viewframe on 30,000 single-interval entries takes about 10 s.

A chromosome with only one interval can't overlap anything, so this returns early when every chromosome is a singleton and otherwise runs the overlap check only on chromosomes that appear more than once. The overlap check is already the last check in is_viewframe, so nothing else is skipped.

With this change the 30,000-entry case takes about 0.01 s. Views where every chromosome has several intervals still go through the full check.

I added tests in test_core_checks.py checking that singleton, unique and mixed views give the same result as the full overlap check.

Addresses #114.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

1 participant