You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This discussion was converted from issue #289 on January 24, 2024 16:43.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
When using the code below from issue #103, how would I also write the weights in the new cooler file?
c = cooler.Cooler('no_chrM.cool')
chromsizes = cooler.util.fetch_chromsizes('mm9')[:'chrY']
bins_without_chrM = cooler.binnify(chromsizes, binsize)
chunksize = 10000000
spans = cooler.tools.partition(0, len(c.pixels()), chunksize)
def chunk_generator():
for i, (lo, hi) in enumerate(spans):
print('chunk', i)
pixels = c.pixels()[lo:hi]
# only necessary if there are chrM hits
pixels = cooler.annotate(pixels, c.bins()[['chrom']], replace=False)
pixels = pixels[(pixels.chrom1 != 'chrM') & (pixels.chrom2 != 'chrM')]
yield pixels
cooler.io.create(<output_file>, bins_without_chrM, chunk_generator())
Beta Was this translation helpful? Give feedback.
All reactions