def fetch_array(self, genome_range, genome_range2=None, balance=None, resolution='auto'): """ Parameters ---------- genome_range : {str, GenomeRange} Intervals within input chromosome range. genome_range2 : {str, GenomeRange}, optional. balance : bool, optional balance matrix or not, default `self.is_balance`. resolution : {'auto', int} resolution of the data. for example 5000. 'auto' for calculate resolution automatically. default 'auto' Return ------ arr : numpy.ndarray """ from coolbox.utilities.hic.wrap import CoolerWrap path = self.properties['file'] if balance is None: balance = self.is_balance wrap = CoolerWrap(path, balance=balance, binsize=resolution) arr = wrap.fetch(genome_range, genome_range2) return arr
def fetch_data(self, gr: GenomeRange, gr2=None, **kwargs) -> np.ndarray: from coolbox.utilities.hic.wrap import CoolerWrap path = self.properties['file'] binsize = kwargs.get('resolution', self.properties.get('resolution', 'auto')) wrap = CoolerWrap(path, balance=self.balance, binsize=binsize) arr = wrap.fetch(gr, gr2) self.fetched_binsize = wrap.fetched_binsize # expose fetched binsize return self.fill_zero_nan(arr)
def fetch_matrix(self, genome_range, genome_range2=None, resolution='auto') -> np.ndarray: """ ${fetch_matrix} """ from coolbox.utilities.hic.wrap import CoolerWrap path = self.properties['file'] wrap = CoolerWrap(path, balance=self.balance, binsize=resolution) arr = wrap.fetch(genome_range, genome_range2) self.fetched_binsize = wrap.fetched_binsize # expose fetched binsize return self.fill_zero_nan(arr)