Replies: 2 comments
-
Sorry for the late reply. You should be able to follow the same approach using:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
just posting a complete working example here : from cooler.create import ArrayLoader
import h5py
import cooler
h = h5py.File("cworld-test_hg19_C-40000-raw.hdf5", 'r')
heatmap = h['interactions']
# create some bins , using cooler-binnify or some other way
binsize = 40000
chromsizes = pd.read_csv(
'hg19.reduced.chromsizes',
sep='\t',
names=['name', 'length']).set_index('name')['length']
bins = cooler.binnify(chromsizes, binsize)
# turn h5oy dataset (2D matrix) into a stream of sparse matrix chunks :
iterator = ArrayLoader(bins, heatmap, chunksize=int(1e6))
# load that into cooler:
cooler.create_cooler('output.40kb.cool', bins, iterator, dtypes={"count":"int"}, assembly="hg19") couple of notes:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can I convert a numpy array to cooler format? I was looking at this #33
but it seems that the cooler.io.DenseLoader() is gone. How else can I convert my heatmap numpy array to an iterator for the cooler create function?
Beta Was this translation helpful? Give feedback.
All reactions