Query regarding the behavior of bbi.fetch in situations where window_size < bin_size #27
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I think the behavior, while relaxed, is reasonable given the request. You are asking to divide the range chrom, start, end = "chr1", 4500015, 4500016
n_bins = 40
x = np.linspace(start, end, n_bins + 1)
y = f.fetch(chrom, start, end, bins=n_bins)
plt.stairs(values=y, edges=x) Note that |
Beta Was this translation helpful? Give feedback.
-
Thanks for the clarification! |
Beta Was this translation helpful? Give feedback.
I think the behavior, while relaxed, is reasonable given the request. You are asking to divide the range
[4500015, 4500016)
into 40 evenly-spaced bins, so it interpolates appropriately. The UCSC code was designed for plotting in the genome browser, after all. For plotting with matplotlib this would look like:Note that
bins=
does not indicate the size of the bins, but the number of bins to divide the interval into. In your example, the bin size ends up being 0.025bp.