Skip to content

Commit

Permalink
Fix #673, --perGroup should now use the correct index when getting th…
Browse files Browse the repository at this point in the history
…e up/downstream length and such.
  • Loading branch information
dpryan79 committed Feb 28, 2018
1 parent 2d83223 commit f7f01ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion deeptools/plotHeatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ def addProfilePlot(hm, plt, fig, grids, iterNum, iterNum2, perGroup, averageType
for sample_id in range(iterNum):
if perGroup:
title = hm.matrix.group_labels[sample_id]
tickIdx = sample_id % hm.matrix.get_num_samples()
else:
title = hm.matrix.sample_labels[sample_id]
tickIdx = sample_id
if sample_id > 0 and len(yMin) == 1 and len(yMax) == 1:
ax_profile = fig.add_subplot(grids[0, sample_id], sharey=ax_list[0])
else:
Expand Down Expand Up @@ -157,7 +159,7 @@ def addProfilePlot(hm, plt, fig, grids, iterNum, iterNum2, perGroup, averageType

if sample_id == 0 and yAxisLabel != '':
ax_profile.set_ylabel(yAxisLabel)
xticks, xtickslabel = hm.getTicks(sample_id)
xticks, xtickslabel = hm.getTicks(tickIdx)
if np.ceil(max(xticks)) != float(sub_matrix['matrix'].shape[1]):
tickscale = float(sub_matrix['matrix'].shape[1]) / max(xticks)
xticks_use = [x * tickscale for x in xticks]
Expand Down
4 changes: 3 additions & 1 deletion deeptools/plotProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,12 @@ def plot_profile(self):
title = self.hm.matrix.group_labels[plot]
if row != 0 and len(self.y_min) == 1 and len(self.y_max) == 1:
plt.setp(ax.get_yticklabels(), visible=False)
tickIdx = plot % self.hm.matrix.get_num_samples()
else:
title = self.hm.matrix.sample_labels[plot]
if col != 0 and len(self.y_min) == 1 and len(self.y_max) == 1:
plt.setp(ax.get_yticklabels(), visible=False)
tickIdx = plot

ax.set_title(title)
for data_idx in range(self.numlines):
Expand Down Expand Up @@ -747,7 +749,7 @@ def plot_profile(self):
"""

totalWidth = sub_matrix['matrix'].shape[1]
xticks, xtickslabel = self.getTicks(plot)
xticks, xtickslabel = self.getTicks(tickIdx)
if np.ceil(max(xticks)) != float(totalWidth):
tickscale = float(totalWidth) / max(xticks)
xticks_use = [x * tickscale for x in xticks]
Expand Down

0 comments on commit f7f01ed

Please sign in to comment.