uchrom.io

I/O helpers with lazy optional-dependency imports.

uchrom.io.create_contacts_from_cool(pixel_df, particles, min_count=0, min_skip=2)[source]
uchrom.io.create_contacts_from_pairs(df, particles, min_skip=2)

Count contacts between all particles.

uchrom.io.create_particles_from_cool(df, particle_size, prev_particles=None, random_seed=0, max_radius=10, *, min_label='start1', max_label='end2')
uchrom.io.create_particles_from_pairs(df, particle_size, prev_particles=None, random_seed=0, max_radius=10, *, min_label='pos1', max_label='pos2')
uchrom.io.filter_contacts(contacts, genome_ranges)[source]
uchrom.io.load_cool(path, pos='mid')[source]

Load pixels from cooler.

uchrom.io.read_pairs(path)[source]
uchrom.io.read_particles(path)[source]

Read reconstruction output. Auto-detects format by extension.

  • .h5cd → ChromData HDF5 (returned as flat DataFrame)

  • .csv or other → CSV

uchrom.io.remove_violated_contacts(contacts, particles, threshold)[source]
uchrom.io.save_particles(df, path, cell_id=None)[source]

Save reconstruction output. Default format is .h5cd (ChromData).

Format inferred from file extension:

  • .csv → CSV via df.to_csv

  • .h5cd or other → ChromData HDF5 (default)

cell_id is only propagated into the .h5cd branch (CSV has no dedicated cell column). When writing .h5cd it is passed through to ChromData.from_dataframe().