From f7f01ed5264c9ceb165807757ced6b00dc878dd6 Mon Sep 17 00:00:00 2001 From: dpryan79 Date: Wed, 28 Feb 2018 14:44:52 +0100 Subject: [PATCH] Fix #673, --perGroup should now use the correct index when getting the up/downstream length and such. --- deeptools/plotHeatmap.py | 4 +++- deeptools/plotProfile.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/deeptools/plotHeatmap.py b/deeptools/plotHeatmap.py index 482b022c2..336e8bd94 100644 --- a/deeptools/plotHeatmap.py +++ b/deeptools/plotHeatmap.py @@ -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: @@ -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] diff --git a/deeptools/plotProfile.py b/deeptools/plotProfile.py index 2e55acb02..d21e56939 100644 --- a/deeptools/plotProfile.py +++ b/deeptools/plotProfile.py @@ -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): @@ -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]