def normalize_hic(self, iterations=0, max_dev=0.1, silent=False, factor=1): """ Normalize the Hi-C data. It fills the Experiment.norm variable with the Hi-C values divided by the calculated weight. :param 0 iteration: number of iterations :param 0.1 max_dev: iterative process stops when the maximum deviation between the sum of row is equal to this number (0.1 means 10%) :param False silent: does not warn when overwriting weights :param 1 factor: final mean number of normalized interactions wanted per cell (excludes filtered, or bad, out columns) """ bias = iterative(self, iterations=iterations, max_dev=max_dev, bads=self.bads, verbose=not silent) if factor: if not silent: print 'rescaling to factor %d' % factor # get the sum on half of the matrix norm_sum = self.sum(bias) # divide biases target = (norm_sum / float(len(self) * len(self) * factor))**0.5 bias = dict([(b, bias[b] * target) for b in bias]) self.bias = bias
def normalize_hic(self, iterations=0, max_dev=0.1, silent=False): """ Normalize the Hi-C data. It fills the Experiment.norm variable with the Hi-C values divided by the calculated weight. :param 0 iteration: number of iterations :param 0.1 max_dev: iterative process stops when the maximum deviation between the sum of row is equal to this number (0.1 means 10%) :param False silent: does not warn when overwriting weights """ self.bias = iterative(self, iterations=iterations, max_dev=max_dev, bads=self.bads, verbose=not silent)