Skip to content

Commit

Permalink
float64 to float
Browse files Browse the repository at this point in the history
  • Loading branch information
WardDeb committed Aug 10, 2023
1 parent b7f0ac6 commit 1efb579
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions deeptools/heatmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ def read_matrix_file(self, matrix_file):
# split the line into bed interval and matrix values
region = line.split('\t')
chrom, start, end, name, score, strand = region[0:6]
matrix_row = np.ma.masked_invalid(np.fromiter(region[6:], float64))
matrix_row = np.ma.masked_invalid(np.fromiter(region[6:], float))
matrix_rows.append(matrix_row)
starts = start.split(",")
ends = end.split(",")
Expand Down Expand Up @@ -852,7 +852,7 @@ def save_matrix(self, file_name):
# join np_array values
# keeping nans while converting them to strings
if not np.ma.is_masked(score_list[idx]):
float64(score_list[idx])
float(score_list[idx])
matrix_values = "\t".join(
np.char.mod('%f', self.matrix.matrix[idx, :]))
starts = ["{0}".format(x[0]) for x in region[1]]
Expand Down Expand Up @@ -1253,10 +1253,10 @@ def hmcluster(self, k, evaluate_silhouette=True, method='kmeans', clustering_sam
matrix = np.asarray(self.matrix)
matrix_to_cluster = matrix
if clustering_samples is not None:
assert all(i > 0 for i in clustering_samples),\
assert all(i > 0 for i in clustering_samples), \
"all indices should be bigger than or equal to 1."
assert all(i <= len(self.sample_labels) for i in
clustering_samples),\
clustering_samples), \
"each index should be smaller than or equal to {}(total "\
"number of samples.)".format(len(self.sample_labels))

Expand Down Expand Up @@ -1345,7 +1345,7 @@ def removeempty(self):
to_keep = []
score_list = np.ma.masked_invalid(np.mean(self.matrix, axis=1))
for idx, region in enumerate(self.regions):
if np.ma.is_masked(score_list[idx]) or float64(score_list[idx]) == 0:
if np.ma.is_masked(score_list[idx]) or float(score_list[idx]) == 0:
continue
else:
to_keep.append(idx)
Expand Down
8 changes: 4 additions & 4 deletions deeptools/plotHeatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def addProfilePlot(hm, plt, fig, grids, iterNum, iterNum2, perGroup, averageType
ticks[0].label1.set_horizontalalignment('left')
ticks[-1].label1.set_horizontalalignment('right')

globalYmin = min(float64(globalYmin), ax_profile.get_ylim()[0])
globalYmin = min(float(globalYmin), ax_profile.get_ylim()[0])
globalYmax = max(globalYmax, ax_profile.get_ylim()[1])

# It turns out that set_ylim only takes float64s
Expand All @@ -190,11 +190,11 @@ def addProfilePlot(hm, plt, fig, grids, iterNum, iterNum2, perGroup, averageType
lims = [globalYmin, globalYmax]
if localYMin:
if localYMax:
lims = (float64(localYMin), float64(localYMax))
lims = (float(localYMin), float(localYMax))
else:
lims = (float64(localYMin), lims[1])
lims = (float(localYMin), lims[1])
elif localYMax:
lims = (lims[0], float64(localYMax))
lims = (lims[0], float(localYMax))
if lims[0] >= lims[1]:
lims = (lims[0], lims[0] + 1)
ax_list[sample_id].set_ylim(lims)
Expand Down
8 changes: 4 additions & 4 deletions deeptools/plotProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ def plot_profile(self):
self.color_list[coloridx],
label,
plot_type=self.plot_type)
globalYmin = min(float64(globalYmin), ax.get_ylim()[0])
globalYmin = min(float(globalYmin), ax.get_ylim()[0])
globalYmax = max(globalYmax, ax.get_ylim()[1])

# Exclude ticks from all but one subplot by default
Expand Down Expand Up @@ -790,11 +790,11 @@ def plot_profile(self):
lims = [globalYmin, globalYmax]
if localYMin is not None:
if localYMax is not None:
lims = (float64(localYMin), float64(localYMax))
lims = (float(localYMin), float(localYMax))
else:
lims = (float64(localYMin), lims[1])
lims = (float(localYMin), lims[1])
elif localYMax is not None:
lims = (lims[0], float64(localYMax))
lims = (lims[0], float(localYMax))
if lims[0] >= lims[1]:
lims = (lims[0], lims[0] + 1)
ax_list[sample_id].set_ylim(lims)
Expand Down
2 changes: 1 addition & 1 deletion deeptools/sumCoveragePerBin.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_coverage_of_region(self, bamHandle, chrom, regions,
except:
# bigWig input, as used by plotFingerprint
if bamHandle.chroms(chrom):
_ = np.array(bamHandle.stats(chrom, regStart, regEnd, type="mean", nBins=nRegBins), dtype=float64)
_ = np.array(bamHandle.stats(chrom, regStart, regEnd, type="mean", nBins=nRegBins), dtype=float)
_[np.isnan(_)] = 0.0
_ = _ * tileSize
coverages += _
Expand Down

0 comments on commit 1efb579

Please sign in to comment.