Replies: 7 comments
-
yes, the 1st part, a generic cooler-like API for data transformation, does look nice and makes sense to me! Re: 2nd part, cooler_ext.fetch_features, to me, it can be split into two parts:
|
Beta Was this translation helpful? Give feedback.
-
Yes, ultimately pass such an extended cooler object internally around cooltools, because most analysis algorithms require O/E anyways. This would potentially decouple the problem of the So in other words - this idea supersedes the idea of constructing a separate object/class for expected (that would be This would work beautifully during a single jupyter-notebook-session , but it less clear to how to extend this to CLI:
|
Beta Was this translation helpful? Give feedback.
-
there is a related PR into sandbox https://github.com/open2c/cooltools/pull/391/files -> this enables that full expected calculation for entire genome (given a genome partition in the provided notebook in that PR demonstrates how we can combine expected with that cooler - to store in cooler-like file and I just remembered that we did a tiny proof of principle demo for 4DN - where we show on the fly Obs/Exp using python-higlass https://github.com/sergpolly/oe-tileset-example - taking bits and pieces from clodius/higlass-engine behind cooler visualization and modifying it ... |
Beta Was this translation helpful? Give feedback.
-
I like the proposal ! in general, being able to fetch a obs/exp matrices for a bioFrame of regions (in some smart way) would be great as well as a bedPE-like (bioPairFrame?) set of pixels. |
Beta Was this translation helpful? Give feedback.
-
all of a sudden a generic Observed/Expected fetcher(query engine) is needed for many things, including tests for current implementation of pileups , some visulaizations etc etc. So, I was able to get a very simple fetcher going, still using mostly public cooler API i.e. using # instantiate CoolerExt object - bundle cooler, expected and view together
cext = CoolerExt(
"test.cool", # regular cooler URI
expected = expected_df, # conforming https://github.com/open2c/cooltools/issues/280
view_df = view_arms_df, # non-overlapping genome partitioning to regions
)
# now we can start fetching
# dense matrices
cext.normalized_matrix()[50:100, 50:100]
cext.normalized_matrix().fetch("chr1", "chr2")
# sparse matrices
cext.normalized_matrix(sparse=True).fetch("chr1")
# as pixels (but observed over expected of course !)
cext.normalized_matrix(as_pixels=True).fetch("chr1")
# underlying cooler (observed data !) can be still accessed as
cext.matrix().fetch("chr3")
# all of the cooler's methods/properties are accessible via cext still corresponding jupyter walkthrough is here https://gist.github.com/sergpolly/2cb54bf77497823d2b69e73b12f6526a Maybe we should try composition instead - i.e. have # same way of accessing normalized data (observed/expected)
cext.normalized_matrix()[50:100, 50:100]
# BUT underlying cooler (observed data !) is accessed like so
cext.clr.matrix().fetch("chr3")
# underlying cooler/clr methods are no longer accessible via cext
# but can rewritten/modified (!) Also - need to take into account that |
Beta Was this translation helpful? Give feedback.
-
from March 4 discussion:
|
Beta Was this translation helpful? Give feedback.
-
@WhittakerWave has some promising results that the sparse eigendecomposition from @sergpolly can be sped up by a factor of ~50x if the obsexp pixel values are computed once instead of on the fly. Is https://github.com/open2c/cooltools/blob/master/cooltools/sandbox/observed_over_expected_example.ipynb still the best example of precomputing an obs/exp cooler? |
Beta Was this translation helpful? Give feedback.
-
wouldn't it be great if the following was possible ?
Another potentially nice API related to the one above - either a pileup replacement or addition - pyBBI inspired:
Beta Was this translation helpful? Give feedback.
All reactions