Skip to content

Commit

Permalink
v2.1.2: enhancements and minor fixes to plots
Browse files Browse the repository at this point in the history
  • Loading branch information
donovan-h-parks committed Jun 14, 2015
1 parent 9c1edf3 commit 279a083
Show file tree
Hide file tree
Showing 20 changed files with 437 additions and 158 deletions.
45 changes: 45 additions & 0 deletions examples/CoalSeamGas/coal.metadata.single_column_test.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Sample Id
573857
573852
573861
573859
573862
573860
573855
573858
619007
619006
573863
573864
573865
573866
573867
573868
573869
573870
573871
573880
573882
573877
573878
573879
573886
573887
573874
573875
573876
573890
573891
573888
573889
573895
573898
573899
573900
573892
573901
573893
573894
573896
573897
573902
6 changes: 3 additions & 3 deletions stamp/STAMP.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
__copyright__ = 'Copyright 2013'
__credits__ = ['Donovan Parks']
__license__ = 'GPL3'
__version__ = '2.1.1'
__date__ = 'June 7, 2015'
__version__ = '2.1.2'
__date__ = 'June 15, 2015'
__maintainer__ = 'Donovan Parks'
__email__ = '[email protected]'
__status__ = 'Development'
Expand Down Expand Up @@ -790,7 +790,7 @@ def loadProfile(self):
self.ui.cboProfileLevel.setCurrentIndex(0)

# setup group legend
if self.metadata != None:
if self.metadata != None and len(self.metadata.getFeatures()) != 0:
self.groupLegendDlg.initLegend(self.profileTree, self.metadata, self.metadata.getFeatures()[0])
self.preferences['Group colours'] = self.groupLegendDlg.groupColourDict

Expand Down
6 changes: 5 additions & 1 deletion stamp/plugins/groups/plots/ExtendedErrorBar.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def plot(self, profile, statsResults):

if self.bShowCorrectedPvalues:
pValueLabels = statsResults.getColumnAsStr('pValuesCorrected')
pValueTitle += ' (corrected)'
if statsResults.multCompCorrection.method != 'No correction':
pValueTitle += ' (corrected)'
else:
pValueLabels = statsResults.getColumnAsStr('pValues')

Expand Down Expand Up @@ -369,6 +370,9 @@ def plot(self, profile, statsResults):
a.tick1On=False
a.tick2On=False

for loc, spine in axRight.spines.iteritems():
spine.set_color('none')

# *** Legend
if self.legendPos != -1:
legend1 = Rectangle((0, 0), 1, 1, fc=group1Colour)
Expand Down
20 changes: 12 additions & 8 deletions stamp/plugins/groups/plots/HeatmapPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ def plot(self, profile, statsResults):
longestColLabel = colHeaders[i]

# *** Check sorting method and adjust dendrogram parameters appropriately
if self.sortRowMethod == 'Alphabetical order':
if self.sortRowMethod == 'Alphabetical order' or self.sortRowMethod == 'Mean abundance':
self.bShowRowDendrogram = False

if self.sortColMethod == 'Alphabetical order':
if self.sortColMethod == 'Alphabetical order' or self.sortColMethod == 'Mean abundance':
self.bShowColDendrogram = False

# *** Set figure size
Expand Down Expand Up @@ -294,17 +294,21 @@ def plot(self, profile, statsResults):
legendY = heatmapY + heatmapH + (1.5*yLabelBounds.height) + 0.1/self.figWidth

# plot dendrograms
if self.sortRowMethod != 'Alphabetical order':
if self.sortRowMethod == 'Alphabetical order':
leafIndex1 = numpy.argsort(rowHeaders)[::-1]
elif self.sortRowMethod == 'Mean abundance':
leafIndex1 = numpy.argsort(numpy.mean(matrix, axis=1))
else:
axisRowDendrogram = self.fig.add_axes([rowDendrogramX, rowDendrogramY, rowDendrogramW, rowDendrogramH], frame_on=False)
ind1, leafIndex1 = self.plotDendrogram(matrix, axisRowDendrogram, self.sortRowMethod, self.clusteringRowThreshold, 'right', bPlot = self.bShowRowDendrogram)
else:
leafIndex1 = numpy.argsort(rowHeaders)[::-1]

if self.sortColMethod != 'Alphabetical order':
if self.sortColMethod == 'Alphabetical order':
leafIndex2 = numpy.argsort(colHeaders)
elif self.sortColMethod == 'Mean abundance':
leafIndex2 = numpy.argsort(numpy.mean(matrix, axis=0))
else:
axisColDendrogram = self.fig.add_axes([colDendrogramX, colDendrogramY, colDendrogramW, colDendrogramH], frame_on=False)
ind2, leafIndex2 = self.plotDendrogram(matrix.T, axisColDendrogram, self.sortColMethod, self.clusteringColThreshold, 'top', bPlot = self.bShowColDendrogram)
else:
leafIndex2 = numpy.argsort(colHeaders)

# *** Handle mouse events
xCell = []
Expand Down
5 changes: 5 additions & 0 deletions stamp/plugins/groups/plots/configGUI/HeatmapPlot.ui
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@
<string>Alphabetical order</string>
</property>
</item>
<item>
<property name="text">
<string>Mean abundance</string>
</property>
</item>
<item>
<property name="text">
<string>Average neighbour (UPGMA)</string>
Expand Down
14 changes: 8 additions & 6 deletions stamp/plugins/groups/plots/configGUI/HeatmapPlotUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file 'HeatmapPlot.ui'
#
# Created: Fri Nov 07 10:43:39 2014
# Created: Fri Jun 12 15:15:44 2015
# by: PyQt4 UI code generator 4.9.6
#
# WARNING! All changes made in this file will be lost!
Expand Down Expand Up @@ -149,6 +149,7 @@ def setupUi(self, HeatmapPlotDialog):
self.cboRowSortMethod.addItem(_fromUtf8(""))
self.cboRowSortMethod.addItem(_fromUtf8(""))
self.cboRowSortMethod.addItem(_fromUtf8(""))
self.cboRowSortMethod.addItem(_fromUtf8(""))
self.horizontalLayout_5.addWidget(self.cboRowSortMethod)
self.verticalLayout_2.addLayout(self.horizontalLayout_5)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
Expand Down Expand Up @@ -343,11 +344,12 @@ def retranslateUi(self, HeatmapPlotDialog):
self.groupBox.setTitle(_translate("HeatmapPlotDialog", "Sort rows", None))
self.lblDendrogramMethod.setText(_translate("HeatmapPlotDialog", "Methods:", None))
self.cboRowSortMethod.setItemText(0, _translate("HeatmapPlotDialog", "Alphabetical order", None))
self.cboRowSortMethod.setItemText(1, _translate("HeatmapPlotDialog", "Average neighbour (UPGMA)", None))
self.cboRowSortMethod.setItemText(2, _translate("HeatmapPlotDialog", "Centroid", None))
self.cboRowSortMethod.setItemText(3, _translate("HeatmapPlotDialog", "Furthest neighbour", None))
self.cboRowSortMethod.setItemText(4, _translate("HeatmapPlotDialog", "Nearest neighbour", None))
self.cboRowSortMethod.setItemText(5, _translate("HeatmapPlotDialog", "Ward", None))
self.cboRowSortMethod.setItemText(1, _translate("HeatmapPlotDialog", "Mean abundance", None))
self.cboRowSortMethod.setItemText(2, _translate("HeatmapPlotDialog", "Average neighbour (UPGMA)", None))
self.cboRowSortMethod.setItemText(3, _translate("HeatmapPlotDialog", "Centroid", None))
self.cboRowSortMethod.setItemText(4, _translate("HeatmapPlotDialog", "Furthest neighbour", None))
self.cboRowSortMethod.setItemText(5, _translate("HeatmapPlotDialog", "Nearest neighbour", None))
self.cboRowSortMethod.setItemText(6, _translate("HeatmapPlotDialog", "Ward", None))
self.lblClusteringThreshold.setText(_translate("HeatmapPlotDialog", "Dendrogram clustering threshold:", None))
self.chkShowRowDendrogram.setText(_translate("HeatmapPlotDialog", "Show dendrogram", None))
self.lblDendrogramWidth.setText(_translate("HeatmapPlotDialog", "Width (inches):", None))
Expand Down
4 changes: 2 additions & 2 deletions stamp/plugins/groups/plots/pcaPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def plot(self, profile, statsResults):

axesExpandPercentage = 0.1

border = 0.25 # inches
border = 0.4 # inches
plotSpacing = 0.15
xLabelOffset = 0.5
yLabelOffset = 0.2
Expand Down Expand Up @@ -416,7 +416,7 @@ def configure(self, profile, statsResults):
self.bShowPC1vsPC3 = configDlg.ui.chkPC1vsPC3.isChecked()
self.bShowPC3vsPC2 = configDlg.ui.chkPC3vsPC2.isChecked()

# legend position
# legend position
if configDlg.ui.radioLegendPosUpperLeft.isChecked() == True:
self.legendPos = 2
elif configDlg.ui.radioLegendPosLowerLeft.isChecked() == True:
Expand Down
20 changes: 12 additions & 8 deletions stamp/plugins/multiGroups/plots/HeatmapPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ def plot(self, profile, statsResults):
longestColLabel = colHeaders[i]

# *** Check sorting method and adjust dendrogram parameters appropriately
if self.sortRowMethod == 'Alphabetical order':
if self.sortRowMethod == 'Alphabetical order' or self.sortRowMethod == 'Mean abundance':
self.bShowRowDendrogram = False

if self.sortColMethod == 'Alphabetical order':
if self.sortColMethod == 'Alphabetical order' or self.sortColMethod == 'Mean abundance':
self.bShowColDendrogram = False

# *** Set figure size
Expand Down Expand Up @@ -297,17 +297,21 @@ def plot(self, profile, statsResults):
legendY = heatmapY + heatmapH + (1.5*yLabelBounds.height) + 0.1/self.figWidth

# plot dendrograms
if self.sortRowMethod != 'Alphabetical order':
if self.sortRowMethod == 'Alphabetical order':
leafIndex1 = numpy.argsort(rowHeaders)[::-1]
elif self.sortRowMethod == 'Mean abundance':
leafIndex1 = numpy.argsort(numpy.mean(matrix, axis=1))
else:
axisRowDendrogram = self.fig.add_axes([rowDendrogramX, rowDendrogramY, rowDendrogramW, rowDendrogramH], frame_on=False)
ind1, leafIndex1 = self.plotDendrogram(matrix, axisRowDendrogram, self.sortRowMethod, self.clusteringRowThreshold, 'right', bPlot = self.bShowRowDendrogram)
else:
leafIndex1 = numpy.argsort(rowHeaders)[::-1]

if self.sortColMethod != 'Alphabetical order':
if self.sortColMethod == 'Alphabetical order':
leafIndex2 = numpy.argsort(colHeaders)
elif self.sortColMethod == 'Mean abundance':
leafIndex2 = numpy.argsort(numpy.mean(matrix, axis=0))
else:
axisColDendrogram = self.fig.add_axes([colDendrogramX, colDendrogramY, colDendrogramW, colDendrogramH], frame_on=False)
ind2, leafIndex2 = self.plotDendrogram(matrix.T, axisColDendrogram, self.sortColMethod, self.clusteringColThreshold, 'top', bPlot = self.bShowColDendrogram)
else:
leafIndex2 = numpy.argsort(colHeaders)

# *** Handle mouse events
xCell = []
Expand Down
3 changes: 3 additions & 0 deletions stamp/plugins/multiGroups/plots/PostHocPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ def plot(self, profile, statsResults):
for a in axRight.yaxis.majorTicks:
a.tick1On=False
a.tick2On=False

for loc, spine in axRight.spines.iteritems():
spine.set_color('none')

self.updateGeometry()
self.draw()
Expand Down
5 changes: 5 additions & 0 deletions stamp/plugins/multiGroups/plots/configGUI/HeatmapPlot.ui
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@
<string>Alphabetical order</string>
</property>
</item>
<item>
<property name="text">
<string>Mean abundance</string>
</property>
</item>
<item>
<property name="text">
<string>Average neighbour (UPGMA)</string>
Expand Down
14 changes: 8 additions & 6 deletions stamp/plugins/multiGroups/plots/configGUI/HeatmapPlotUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file 'HeatmapPlot.ui'
#
# Created: Fri Nov 07 11:02:38 2014
# Created: Fri Jun 12 15:14:54 2015
# by: PyQt4 UI code generator 4.9.6
#
# WARNING! All changes made in this file will be lost!
Expand Down Expand Up @@ -149,6 +149,7 @@ def setupUi(self, HeatmapPlotDialog):
self.cboRowSortMethod.addItem(_fromUtf8(""))
self.cboRowSortMethod.addItem(_fromUtf8(""))
self.cboRowSortMethod.addItem(_fromUtf8(""))
self.cboRowSortMethod.addItem(_fromUtf8(""))
self.horizontalLayout_5.addWidget(self.cboRowSortMethod)
self.verticalLayout_2.addLayout(self.horizontalLayout_5)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
Expand Down Expand Up @@ -343,11 +344,12 @@ def retranslateUi(self, HeatmapPlotDialog):
self.groupBox.setTitle(_translate("HeatmapPlotDialog", "Sort rows", None))
self.lblDendrogramMethod.setText(_translate("HeatmapPlotDialog", "Methods:", None))
self.cboRowSortMethod.setItemText(0, _translate("HeatmapPlotDialog", "Alphabetical order", None))
self.cboRowSortMethod.setItemText(1, _translate("HeatmapPlotDialog", "Average neighbour (UPGMA)", None))
self.cboRowSortMethod.setItemText(2, _translate("HeatmapPlotDialog", "Centroid", None))
self.cboRowSortMethod.setItemText(3, _translate("HeatmapPlotDialog", "Furthest neighbour", None))
self.cboRowSortMethod.setItemText(4, _translate("HeatmapPlotDialog", "Nearest neighbour", None))
self.cboRowSortMethod.setItemText(5, _translate("HeatmapPlotDialog", "Ward", None))
self.cboRowSortMethod.setItemText(1, _translate("HeatmapPlotDialog", "Mean abundance", None))
self.cboRowSortMethod.setItemText(2, _translate("HeatmapPlotDialog", "Average neighbour (UPGMA)", None))
self.cboRowSortMethod.setItemText(3, _translate("HeatmapPlotDialog", "Centroid", None))
self.cboRowSortMethod.setItemText(4, _translate("HeatmapPlotDialog", "Furthest neighbour", None))
self.cboRowSortMethod.setItemText(5, _translate("HeatmapPlotDialog", "Nearest neighbour", None))
self.cboRowSortMethod.setItemText(6, _translate("HeatmapPlotDialog", "Ward", None))
self.lblClusteringThreshold.setText(_translate("HeatmapPlotDialog", "Dendrogram clustering threshold:", None))
self.chkShowRowDendrogram.setText(_translate("HeatmapPlotDialog", "Show dendrogram", None))
self.lblDendrogramWidth.setText(_translate("HeatmapPlotDialog", "Width (inches):", None))
Expand Down
Loading

0 comments on commit 279a083

Please sign in to comment.