bandhic.band_hic_matrix.extract_row#

band_hic_matrix.extract_row(idx, extract_out_of_band=True)[source]#

Extract stored, unmasked band values for a given row or column.

Parameters:
  • idx (int) – Row (or column, due to symmetry) index for which to extract band values.

  • extract_out_of_band (bool, optional) – If True, include out-of-band entries filled with default_value and masked if appropriate. If False (default), return only the stored band values.

Returns:

If extract_out_of_band=False, a 1D array of length up to diag_num containing band values. If extract_out_of_band=True, a 1D array of length bin_num with all row/column values.

Return type:

ndarray or MaskedArray

Raises:

ValueError – If idx is outside the range [0, bin_num-1].

Examples

>>> import bandhic as bh
>>> mat = bh.band_hic_matrix(np.arange(9).reshape(3,3), diag_num=2)
>>> mat.extract_row(0, extract_out_of_band=False)
array([0, 1])
>>> mat.extract_row(0)
array([0, 1, 0])