epiout.hic

Module Contents

Classes

HicReader

Read chromotain contacts information from Hi-C data from hic files.

Functions

import_hicstraw()

Import optional dependency hic-straw if installed in env,

epiout.hic.import_hicstraw()
Import optional dependency hic-straw if installed in env,

otherwise raise an error.

class epiout.hic.HicReader(hic_file_paths: List[str], chrom_sizes: str, normalization='NONE', binsize=5000, bin_vicinity=200, batch_size=500000)

Read chromotain contacts information from Hi-C data from hic files.

Parameters
  • hic_file_paths – List of hic file paths.

  • chrom_sizes – Chromosome sizes file path.

  • normalization – Normalization method for Hi-C data (default=None). Valid normalization methods defined in hic-straw package.

  • binsize – Bin size for Hi-C data (default=5_000).

  • bin_vicinity – Number of bins to consider around the diagonal (default=200) so defaults consider 1 Mb vicinity.

  • batch_size – Batch size for reading Hi-C data (default=500_000). Too large may cause memory issues and too small may cause performance issues.

static _read_chrom_sizes(chrom_sizes)

Read chromosome sizes from file.

Returns

Dictionary of chromosome sizes.

static match_chrom(chrom, chroms)

Match chromosome name with the chromosome names in the hic file.

Parameters
  • chrom – Chromosome name.

  • chroms – Chromosome names in the hic file.

Returns

Matched chromosome name.

_read_contacts(self, chrom)

Read contacts from hic file for given chromosome.

Parameters

chrom – Chromosome name.

Yields

Contact matrix for given chromosome as numpy array

contact_scores(self, chrom)

Calculate contact scores for given chromosome.

Parameters

chrom – Chromosome name.

Returns

Contact scores as numpy array.