Skip to Content

FragmentIndex

class chr3d.peak_based.purifying.FragmentIndex( bed_path: str, )

In-memory index of restriction fragments for fast overlap lookup.

Uses bisect for O(log N) overlap queries against a sorted interval list. Chromosomes are stored in separate lists to avoid cross-chromosome comparisons.

Parameters

ParameterTypeDescription
bed_pathstrPath to BED file with restriction fragments

Methods

find_overlapping

def find_overlapping( self, chrom: str, start: int, end: int, ) -> Optional[Tuple[int, int, int]]

Find a fragment overlapping the interval [start, end) on chrom.

Parameters:

ParameterTypeDescription
chromstrChromosome name
startintInterval start position (0-based)
endintInterval end position (exclusive)

Returns:

Optional[Tuple[int, int, int]](start, end, frag_idx) of the overlapping fragment, or None if no overlap.

Last updated on