coverage#
- Interval.coverage(intervals, *, bin_size=1)[source]#
Computes coverage track from sequence of intervals overlapping interval.
This method calculates the coverage of this interval by a set of other intervals. The coverage is defined as the number of intervals that overlap each position within this interval.
The
bin_sizeparameter allows you to bin the coverage into equal-sized windows. This can be useful for summarizing coverage over larger regions. Ifbin_sizeis 1, the coverage is calculated at single-base resolution.- Parameters:
- Return type:
- Returns:
A 1D numpy array representing the coverage track. The length of the array is
self.width // bin_size. Each element in the array represents the summed coverage within the corresponding bin.- Raises:
ValueError – If
bin_sizeis not a positive integer or if the interval width is not divisible bybin_size.