.hic API¶
- class hictkpy.hic.FileWriter(*args, **kwargs)¶
Class representing a file handle to create .hic files.
- __init__(
- self,
- path: str | PathLike,
- chromosomes: dict[str, int],
- resolution: int,
- assembly: str = 'unknown',
- n_threads: int = 1,
- chunk_size: int = 10000000,
- tmpdir: str | PathLike = PosixPath('/tmp'),
- compression_lvl: int = 10,
- skip_all_vs_all_matrix: bool = False,
- __init__(
- self,
- path: str | PathLike,
- chromosomes: dict[str, int],
- resolutions: Sequence[int],
- assembly: str = 'unknown',
- n_threads: int = 1,
- chunk_size: int = 10000000,
- tmpdir: str | PathLike = PosixPath('/tmp'),
- compression_lvl: int = 10,
- skip_all_vs_all_matrix: bool = False,
- __init__(
- self,
- path: str | PathLike,
- bins: BinTable,
- assembly: str = 'unknown',
- n_threads: int = 1,
- chunk_size: int = 10000000,
- tmpdir: str | PathLike = PosixPath('/tmp'),
- compression_lvl: int = 10,
- skip_all_vs_all_matrix: bool = False,
Overloaded function.
__init__(self, path: str | os.PathLike, chromosomes: dict[str, int], resolution: int, assembly: str = 'unknown', n_threads: int = 1, chunk_size: int = 10000000, tmpdir: str | os.PathLike = PosixPath('/tmp'), compression_lvl: int = 10, skip_all_vs_all_matrix: bool = False) -> None
Open a .hic file for writing given a list of chromosomes with their sizes and one resolution.
__init__(self, path: str | os.PathLike, chromosomes: dict[str, int], resolutions: collections.abc.Sequence[int], assembly: str = 'unknown', n_threads: int = 1, chunk_size: int = 10000000, tmpdir: str | os.PathLike = PosixPath('/tmp'), compression_lvl: int = 10, skip_all_vs_all_matrix: bool = False) -> None
Open a .hic file for writing given a list of chromosomes with their sizes and one or more resolutions.
__init__(self, path: str | os.PathLike, bins: hictkpy._hictkpy.BinTable, assembly: str = 'unknown', n_threads: int = 1, chunk_size: int = 10000000, tmpdir: str | os.PathLike = PosixPath('/tmp'), compression_lvl: int = 10, skip_all_vs_all_matrix: bool = False) -> None
Open a .hic file for writing given a BinTable. Only BinTable with a fixed bin size are supported.
- __enter__(self) FileWriter¶
- __exit__(
- self,
- exc_type: object | None = None,
- exc_value: object | None = None,
- traceback: object | None = None,
- add_pixels( ) None¶
Add pixels from a pandas.DataFrame or pyarrow.Table containing pixels in COO or BG2 format (i.e. either with columns=[bin1_id, bin2_id, count] or with columns=[chrom1, start1, end1, chrom2, start2, end2, count]). When sorted is True, pixels are assumed to be sorted by their genomic coordinates in ascending order. When validate is True, hictkpy will perform some basic sanity checks on the given pixels before adding them to the .hic file.
- add_pixels_from_dict( ) None¶
Add pixels from a dictionary containing containing columns corresponding to pixels in COO or BG2 format (i.e. either with keys=[bin1_id, bin2_id, count] or with keys=[chrom1, start1, end1, chrom2, start2, end2, count]). When sorted is True, pixels are assumed to be sorted by their genomic coordinates in ascending order. When validate is True, hictkpy will perform some basic sanity checks on the given pixels before adding them to the Cooler file.
- chromosomes(self, include_ALL: bool = False) dict[str, int]¶
Get the chromosome sizes as a dictionary mapping names to sizes.
- resolutions(self) numpy.ndarray[dtype=int64, shape=(*), order='C']¶
Get the list of resolutions in bp.