Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if rot_flip:
newmap = np.rot90(np.flipud(newmap), -1)
elif flip_rot:
newmap = np.flipud(np.rot90(newmap))
mymap += np.nan_to_num(newmap)
if unbalanced and cov_norm and expected is False:
new_cov_start = coverage[lo_left:hi_left]
new_cov_end = coverage[lo_right:hi_right]
if rescale:
if len(new_cov_start)==0:
new_cov_start = np.zeros(rescale_size)
if len(new_cov_end)==0:
new_cov_end = np.zeros(rescale_size)
new_cov_start = numutils.zoom_array(new_cov_start,
(rescale_size,))
new_cov_end = numutils.zoom_array(new_cov_end,
(rescale_size,))
else:
l = len(new_cov_start)
r = len(new_cov_end)
new_cov_start = np.pad(new_cov_start, (mymap.shape[0]-l, 0),
'constant')
new_cov_end = np.pad(new_cov_end,
(0, mymap.shape[1]-r), 'constant')
cov_start += np.nan_to_num(new_cov_start)
cov_end += +np.nan_to_num(new_cov_end)
n += 1
if local:
mymap = np.triu(mymap, 0)
mymap += np.rot90(np.fliplr(np.triu(mymap, 1)))
return mymap, n, cov_start, cov_end
elif rot:
newmap = np.rot90(newmap, -1)
mymap = np.nansum([mymap, newmap], axis=0)
if self.coverage_norm and not expected and (self.balance is False):
new_cov_start = coverage[lo_left:hi_left]
new_cov_end = coverage[lo_right:hi_right]
if self.rescale:
if len(new_cov_start) == 0:
new_cov_start = np.zeros(self.rescale_size)
if len(new_cov_end) == 0:
new_cov_end = np.zeros(self.rescale_size)
new_cov_start = numutils.zoom_array(
new_cov_start, (self.rescale_size,)
)
new_cov_end = numutils.zoom_array(new_cov_end, (self.rescale_size,))
else:
l = len(new_cov_start)
r = len(new_cov_end)
new_cov_start = np.pad(
new_cov_start, (mymap.shape[0] - l, 0), "constant"
)
new_cov_end = np.pad(
new_cov_end, (0, mymap.shape[1] - r), "constant"
)
cov_start += np.nan_to_num(new_cov_start)
cov_end += +np.nan_to_num(new_cov_end)
num += np.isfinite(newmap).astype(int)
n += 1
return mymap, num, cov_start, cov_end, n
)
if rot_flip:
newmap = np.rot90(np.flipud(newmap), 1)
elif rot:
newmap = np.rot90(newmap, -1)
mymap = np.nansum([mymap, newmap], axis=0)
if self.coverage_norm and not expected and (self.balance is False):
new_cov_start = coverage[lo_left:hi_left]
new_cov_end = coverage[lo_right:hi_right]
if self.rescale:
if len(new_cov_start) == 0:
new_cov_start = np.zeros(self.rescale_size)
if len(new_cov_end) == 0:
new_cov_end = np.zeros(self.rescale_size)
new_cov_start = numutils.zoom_array(
new_cov_start, (self.rescale_size,)
)
new_cov_end = numutils.zoom_array(new_cov_end, (self.rescale_size,))
else:
l = len(new_cov_start)
r = len(new_cov_end)
new_cov_start = np.pad(
new_cov_start, (mymap.shape[0] - l, 0), "constant"
)
new_cov_end = np.pad(
new_cov_end, (0, mymap.shape[1] - r), "constant"
)
cov_start += np.nan_to_num(new_cov_start)
cov_end += +np.nan_to_num(new_cov_end)
num += np.isfinite(newmap).astype(int)
n += 1