-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unclear Cooler.pixels().fetch behavior #455
Comments
I think this behaviour is intended and working as documented.
|
Hey @kloetzl, what you linked is the documentation for import cooler
handle = cooler.Cooler("test_files/yeast.10kb.cool")
print(handle.pixels().fetch("chrII", "chrII")) raises |
Well caught, but I think the same logic still applies here.
|
Summoning @nvictus |
Just wanted to report a behavior which I assume is intentional but might be misleading (or at least it was for me).
When using
Cooler.pixels().fetch("<some_genomic_region>")
, an instance of the classRangeSelector1D
is returned. This selector returns all the pixels where the first bin id belongs to the provided interval. As an example, using theyeast.10kb.cool
file in thetests/data
folder:returns:
which checks out since:
The issue (in my opinion) is that it does not return all pixels with at least one bin in the region. There can be pixels where the second bin belongs to the region and yet they are not returned.
returns:
I understand why this might be the case. There is no easy way of indexing the
bin2_id
column, therefore finding these pixels would require iterating and filtering all pixels prior to the retrieved slice. This would clash with the lazy fetching and most likely be slow.Understanding why this behavior might not change, I believe it should be clearly stated in the documentation (I did not find anything about it but I might have missed it), since one could get misleading results. I would be happy to open a PR to either change or document the behavior if needed.
The text was updated successfully, but these errors were encountered: