cooler icon indicating copy to clipboard operation
cooler copied to clipboard

Dump a list of paired interaction from a cool file

Open Gonysh opened this issue 4 years ago • 2 comments

Hello Coolers,

I have a list of chromatin interaction and I want to extract normalized interaction values for them from my cool files. However, I could only find a way to extract one interation at a time, iterating with cooler dump as follow:

cooler dump $cool -t pixels --join -r "$chr1:$start1-$end1" -r2 "$chr1:$start2-$end2" --balanced >> $out

This works fine for short lists of interactions. However, I sometimes need to extract values for tens of thousands of interactions and that takes days. Is there a more efficient method to extract lists of interactions from a cool file? I tried looking at both the CLI and API documentations and couldn't find anything.

Please help, Thanks alot!

Gonysh avatar Dec 13 '20 13:12 Gonysh

Hi,

not 100% if this what you need but there is the fetch function: https://cooler.readthedocs.io/en/latest/concepts.html#matrix-selector https://cooler.readthedocs.io/en/latest/concepts.html#table-selectors-chroms-bins-pixels Best,

Joachim

joachimwolff avatar Dec 13 '20 13:12 joachimwolff

If you want to extract all interactions over a range of coordinates, try omitting r2:

cooler dump $cool -t pixels --join -r "$chr1:$start1-$end2" --balanced 

jakevc avatar May 17 '21 17:05 jakevc