Apply same balance weights to different samples #368
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There is no CLI tool for this yet, but it's a just a few lines of Python to copy bin table columns between files, assuming the bin tables are aligned. import cooler
# optional
h5opts = dict(compression='gzip', compression_opts=6)
clr1 = cooler.Cooler(f'{path1}::resolutions/{binsize}')
weights = clr1.bins()['weight'][:].values
clr2 = cooler.Cooler(f'{path2}::resolutions/{binsize}')
with clr2.open('r+') as f:
# Create a weight column
f['bins'].create_dataset('weight', data=weights, **h5opts)
# .. or overwrite an existing weight column
f['bins/weight'][:] = weights |
Beta Was this translation helpful? Give feedback.
There is no CLI tool for this yet, but it's a just a few lines of Python to copy bin table columns between files, assuming the bin tables are aligned.