Skip to content

Commit 896b894

Browse files
Push to v2.0.9
1 parent b41c9a1 commit 896b894

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

stamp/STAMP.py

+41-41
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
__copyright__ = 'Copyright 2013'
2424
__credits__ = ['Donovan Parks']
2525
__license__ = 'GPL3'
26-
__version__ = '2.0.8'
27-
__date__ = 'August 4, 2014'
26+
__version__ = '2.0.9'
27+
__date__ = 'December 5, 2014'
2828
__maintainer__ = 'Donovan Parks'
2929
__email__ = '[email protected]'
3030
__status__ = 'Development'
@@ -35,7 +35,7 @@
3535
import string
3636

3737
import stamp.Dependencies
38-
from stamp.GUI.plotDlg import PlotDlg # forward reference so py2app recognizes this file is required
38+
from stamp.GUI.plotDlg import PlotDlg # forward reference so py2app recognizes this file is required
3939

4040
from PyQt4 import QtGui, QtCore
4141

@@ -200,7 +200,7 @@ def __init__(self, preferences, parent=None):
200200

201201
self.metadata = None
202202

203-
#self.loadProfile() # *** For debugging purposes
203+
# self.loadProfile() # *** For debugging purposes
204204

205205
def propertiesTabChanged(self, currentIndex):
206206
self.ui.stackedWidgetViews.setCurrentIndex(currentIndex)
@@ -691,7 +691,7 @@ def group1ColourDlg(self):
691691
if colour.isValid():
692692
self.setGroup1Colour(colour)
693693

694-
def setGroup1Colour(self, colour, bUpdatePlot = True):
694+
def setGroup1Colour(self, colour, bUpdatePlot=True):
695695
colourStr = str(colour.red()) + ',' + str(colour.green()) + ',' + str(colour.blue())
696696
self.ui.btnGroup1Colour.setStyleSheet('* { background-color: rgb(' + colourStr + ') }')
697697
self.preferences['Group colours'][self.groupProfile.groupName1] = colour
@@ -706,7 +706,7 @@ def group2ColourDlg(self):
706706
if colour.isValid():
707707
self.setGroup2Colour(colour)
708708

709-
def setGroup2Colour(self, colour, bUpdatePlot = True):
709+
def setGroup2Colour(self, colour, bUpdatePlot=True):
710710
colourStr = str(colour.red()) + ',' + str(colour.green()) + ',' + str(colour.blue())
711711
self.ui.btnGroup2Colour.setStyleSheet('* { background-color: rgb(' + colourStr + ') }')
712712
self.preferences['Group colours'][self.groupProfile.groupName2] = colour
@@ -757,7 +757,7 @@ def loadProfile(self):
757757
QtGui.QMessageBox.information(self, 'Error reading profile file', errMsg, QtGui.QMessageBox.Warning)
758758
return
759759
except:
760-
QtGui.QMessageBox.information(self, 'Error reading profile file','Unknown parsing error.', QtGui.QMessageBox.Warning)
760+
QtGui.QMessageBox.information(self, 'Error reading profile file', 'Unknown parsing error.', QtGui.QMessageBox.Warning)
761761
return
762762

763763
self.metadata = None
@@ -800,7 +800,7 @@ def loadProfile(self):
800800
# indicate the hierarchical level of interest has changed
801801
bGroupLegendVisibility = self.groupLegendDlg.isVisible()
802802
if platform.system() != 'Windows' and bGroupLegendVisibility:
803-
self.groupLegendDlg.setVisible(False) # HACK: OS X crashes if this dialog is open when loading data for the first time!
803+
self.groupLegendDlg.setVisible(False) # HACK: OS X crashes if this dialog is open when loading data for the first time!
804804

805805
self.multiGroupHierarchicalLevelsChanged()
806806
self.groupHierarchicalLevelsChanged()
@@ -829,7 +829,7 @@ def populateGroupComboBoxes(self):
829829

830830
def parentLevelChanged(self):
831831
parentDepth = self.profileTree.getHierarchicalLevelDepth(str(self.ui.cboParentalLevel.currentText()))
832-
profileDepth= self.profileTree.getHierarchicalLevelDepth(str(self.ui.cboProfileLevel.currentText()))
832+
profileDepth = self.profileTree.getHierarchicalLevelDepth(str(self.ui.cboProfileLevel.currentText()))
833833
if parentDepth >= profileDepth:
834834
QtGui.QMessageBox.information(self, 'Invalid profile', 'The parent level must be higher in the hierarchy than the profile level.', QtGui.QMessageBox.Warning)
835835
self.ui.cboParentalLevel.setCurrentIndex(0)
@@ -840,11 +840,11 @@ def parentLevelChanged(self):
840840

841841
def profileLevelChanged(self):
842842
parentDepth = self.profileTree.getHierarchicalLevelDepth(str(self.ui.cboParentalLevel.currentText()))
843-
profileDepth= self.profileTree.getHierarchicalLevelDepth(str(self.ui.cboProfileLevel.currentText()))
843+
profileDepth = self.profileTree.getHierarchicalLevelDepth(str(self.ui.cboProfileLevel.currentText()))
844844

845845
if profileDepth <= parentDepth:
846846
QtGui.QMessageBox.information(self, 'Invalid profile', 'The profile level must be deeper in the hierarchy than the parent level.', QtGui.QMessageBox.Warning)
847-
self.ui.cboProfileLevel.setCurrentIndex(len(self.profileTree.hierarchyHeadings)-1)
847+
self.ui.cboProfileLevel.setCurrentIndex(len(self.profileTree.hierarchyHeadings) - 1)
848848
return
849849

850850
self.sampleHierarchicalLevelsChanged()
@@ -874,7 +874,7 @@ def sampleHierarchicalLevelsChanged(self):
874874
profileIndex = self.profileTree.hierarchyHeadings.index(profileHeading)
875875
self.ui.cboSampleHighlightHierarchy.clear()
876876
self.ui.cboSampleHighlightHierarchy.addItem('None')
877-
for header in self.profileTree.hierarchyHeadings[0:profileIndex+1]:
877+
for header in self.profileTree.hierarchyHeadings[0:profileIndex + 1]:
878878
self.ui.cboSampleHighlightHierarchy.addItem(header)
879879
self.ui.cboSampleHighlightHierarchy.setCurrentIndex(0)
880880

@@ -911,7 +911,7 @@ def groupHierarchicalLevelsChanged(self):
911911
profileIndex = self.profileTree.hierarchyHeadings.index(profileHeading)
912912
self.ui.cboGroupHighlightHierarchy.clear()
913913
self.ui.cboGroupHighlightHierarchy.addItem('None')
914-
for header in self.profileTree.hierarchyHeadings[0:profileIndex+1]:
914+
for header in self.profileTree.hierarchyHeadings[0:profileIndex + 1]:
915915
self.ui.cboGroupHighlightHierarchy.addItem(header)
916916
self.ui.cboGroupHighlightHierarchy.setCurrentIndex(0)
917917

@@ -940,7 +940,7 @@ def multiGroupHierarchicalLevelsChanged(self):
940940
profileIndex = self.profileTree.hierarchyHeadings.index(profileHeading)
941941
self.ui.cboMultiGroupHighlightHierarchy.clear()
942942
self.ui.cboMultiGroupHighlightHierarchy.addItem('None')
943-
for header in self.profileTree.hierarchyHeadings[0:profileIndex+1]:
943+
for header in self.profileTree.hierarchyHeadings[0:profileIndex + 1]:
944944
self.ui.cboMultiGroupHighlightHierarchy.addItem(header)
945945
self.ui.cboMultiGroupHighlightHierarchy.setCurrentIndex(0)
946946

@@ -977,7 +977,7 @@ def groupFeaturesTableUpdate(self):
977977
self.preferences['Selected group feature'] = ''
978978

979979
self.groupFeatureTable = GenericTable(tableData, ['Feature', 'Diff. between means', 'p-value', 'Corrected p-value', 'Note'], self)
980-
self.groupFeatureTable.sort(0,QtCore.Qt.AscendingOrder) # start with features in alphabetical order
980+
self.groupFeatureTable.sort(0, QtCore.Qt.AscendingOrder) # start with features in alphabetical order
981981

982982
self.ui.tableGroupFeatures.horizontalHeader().setStretchLastSection(True)
983983
self.ui.tableGroupFeatures.setModel(self.groupFeatureTable)
@@ -1007,7 +1007,7 @@ def multiGroupFeaturesTableUpdate(self):
10071007
self.preferences['Selected multiple group feature'] = ''
10081008

10091009
self.multiGroupFeatureTable = GenericTable(tableData, ['Feature', 'Eta-squared', 'p-value', 'Corrected p-value', 'Note'], self)
1010-
self.multiGroupFeatureTable.sort(0,QtCore.Qt.AscendingOrder) # start with features in alphabetical order
1010+
self.multiGroupFeatureTable.sort(0, QtCore.Qt.AscendingOrder) # start with features in alphabetical order
10111011

10121012
self.ui.tableMultiGroupFeatures.horizontalHeader().setStretchLastSection(True)
10131013
self.ui.tableMultiGroupFeatures.setModel(self.multiGroupFeatureTable)
@@ -1045,7 +1045,7 @@ def sampleRunTest(self):
10451045
self.ui.cboUnclassified.currentText())
10461046

10471047
# show progress of test
1048-
progress = QtGui.QProgressDialog('Running two-sample statistical test...', 'Cancel', 0, len(self.sampleProfile.getFeatures())+1, self)
1048+
progress = QtGui.QProgressDialog('Running two-sample statistical test...', 'Cancel', 0, len(self.sampleProfile.getFeatures()) + 1, self)
10491049
progress.setWindowTitle('Progress')
10501050
progress.setWindowModality(QtCore.Qt.WindowModal)
10511051
progress.setVisible(True)
@@ -1093,7 +1093,7 @@ def groupRunTest(self):
10931093
self.setGroup2Colour(self.preferences['All other samples colour'])
10941094

10951095
# show progress of test
1096-
progress = QtGui.QProgressDialog('Running two-group statistical test...', 'Cancel', 0, len(self.groupProfile.getFeatures())+1, self)
1096+
progress = QtGui.QProgressDialog('Running two-group statistical test...', 'Cancel', 0, len(self.groupProfile.getFeatures()) + 1, self)
10971097
progress.setWindowTitle('Progress')
10981098
progress.setWindowModality(QtCore.Qt.WindowModal)
10991099
progress.setVisible(True)
@@ -1133,7 +1133,7 @@ def multiGroupRunTest(self):
11331133

11341134
if len(self.multiGroupProfile.activeGroupNames) >= 2:
11351135
# show progress of test
1136-
progress = QtGui.QProgressDialog('Running multiple groups statistical test...', 'Cancel', 0, len(self.multiGroupProfile.getFeatures())+1, self)
1136+
progress = QtGui.QProgressDialog('Running multiple groups statistical test...', 'Cancel', 0, len(self.multiGroupProfile.getFeatures()) + 1, self)
11371137
progress.setWindowTitle('Progress')
11381138
progress.setWindowModality(QtCore.Qt.WindowModal)
11391139
progress.setVisible(True)
@@ -1558,7 +1558,7 @@ def sampleHighlightHierarchyChanged(self):
15581558
featureStrList.append(feature)
15591559

15601560
self.ui.cboSampleHighlightFeature.clear()
1561-
self.ui.cboSampleHighlightFeature.insertItems(len(featureStrList),featureStrList)
1561+
self.ui.cboSampleHighlightFeature.insertItems(len(featureStrList), featureStrList)
15621562
self.ui.cboSampleHighlightFeature.setCurrentIndex(0)
15631563

15641564
self.ui.cboSampleHighlightFeature.adjustSize()
@@ -1586,7 +1586,7 @@ def groupHighlightHierarchyChanged(self):
15861586
featureStrList.append(feature)
15871587

15881588
self.ui.cboGroupHighlightFeature.clear()
1589-
self.ui.cboGroupHighlightFeature.insertItems(len(featureStrList),featureStrList)
1589+
self.ui.cboGroupHighlightFeature.insertItems(len(featureStrList), featureStrList)
15901590
self.ui.cboGroupHighlightFeature.setCurrentIndex(0)
15911591

15921592
self.ui.cboGroupHighlightFeature.adjustSize()
@@ -1614,7 +1614,7 @@ def multiGroupHighlightHierarchyChanged(self):
16141614
featureStrList.append(feature)
16151615

16161616
self.ui.cboMultiGroupHighlightFeature.clear()
1617-
self.ui.cboMultiGroupHighlightFeature.insertItems(len(featureStrList),featureStrList)
1617+
self.ui.cboMultiGroupHighlightFeature.insertItems(len(featureStrList), featureStrList)
16181618
self.ui.cboMultiGroupHighlightFeature.setCurrentIndex(0)
16191619

16201620
self.ui.cboMultiGroupHighlightFeature.adjustSize()
@@ -1691,7 +1691,7 @@ def saveImageDlg(self):
16911691
if f != '':
16921692
self.preferences['Last directory'] = f[0:f.lastIndexOf('/')]
16931693
try:
1694-
if f[len(f)-3:len(f)] == 'png' or f[len(f)-3:len(f)] == 'PNG':
1694+
if f[len(f) - 3:len(f)] == 'png' or f[len(f) - 3:len(f)] == 'PNG':
16951695
dpi, ok = QtGui.QInputDialog.getInteger(self, 'Desired resolution', 'Enter desired resolution (DPI) of image:', 300)
16961696
if ok:
16971697
plotToSave.save(str(f), dpi)
@@ -1760,28 +1760,28 @@ def closeEvent(self, event):
17601760
settings.setValue('Preferences/Minimum reported p-value exponent', self.preferences['Minimum reported p-value exponent'])
17611761

17621762
def exceptHook(exc_type, exc_value, exc_traceback):
1763-
## Copyright (c) 2002-2007 Pascal Varet <[email protected]>
1764-
##
1765-
## Originally part of Spyrit.
1763+
# # Copyright (c) 2002-2007 Pascal Varet <[email protected]>
1764+
# #
1765+
# # Originally part of Spyrit.
17661766

17671767
import traceback
17681768

1769-
## KeyboardInterrupt is a special case.
1770-
## We don't raise the error dialog when it occurs.
1771-
if issubclass( exc_type, KeyboardInterrupt ):
1769+
# # KeyboardInterrupt is a special case.
1770+
# # We don't raise the error dialog when it occurs.
1771+
if issubclass(exc_type, KeyboardInterrupt):
17721772
if qApp():
17731773
qApp().quit()
17741774
return
17751775

1776-
filename, line, dummy, dummy = traceback.extract_tb( exc_traceback ).pop()
1777-
filename = os.path.basename( filename )
1778-
error = "%s: %s" % ( exc_type.__name__, exc_value)
1776+
filename, line, dummy, dummy = traceback.extract_tb(exc_traceback).pop()
1777+
filename = os.path.basename(filename)
1778+
error = "%s: %s" % (exc_type.__name__, exc_value)
17791779

17801780
QtGui.QMessageBox.critical(None, "Unknown error...",
17811781
"<center>An error has occured:<br/><br/>"
17821782
+ "<b><i>%s</i></b><br/>" % error
1783-
+ "It occured at <b>line %d</b> of file <b>%s</b>.<br/>" % ( line, filename )
1784-
+ "</center>" )
1783+
+ "It occured at <b>line %d</b> of file <b>%s</b>.<br/>" % (line, filename)
1784+
+ "</center>")
17851785

17861786
def main():
17871787
# ignore numpy warnings as invalid results are handled within STAMP
@@ -1816,7 +1816,7 @@ def main():
18161816
workingDir = getMainDir()
18171817
preferences['Last directory'] = ''
18181818
if 'STAMP.app/Contents/Resources' in workingDir:
1819-
workingDir = workingDir[0:len(workingDir)-len('/STAMP.app/Contents/Resources')]
1819+
workingDir = workingDir[0:len(workingDir) - len('/STAMP.app/Contents/Resources')]
18201820
preferences['Last directory'] = workingDir
18211821
os.chdir(workingDir)
18221822

@@ -1826,23 +1826,23 @@ def main():
18261826
# the program icon is displayed in the taskbar instead of the generic
18271827
# Python icon.
18281828
import ctypes
1829-
myappid = 'beikolab.software.stamp.2' # arbitrary string
1829+
myappid = 'beikolab.software.stamp.2' # arbitrary string
18301830
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
18311831

18321832
if (platform.system() == 'Windows' and len(sys.argv) == 1) or (platform.system() != 'Windows' and len(sys.argv) <= 2):
18331833
sys.excepthook = exceptHook
18341834
app = QtGui.QApplication(sys.argv)
18351835

1836-
if(False): # profile code
1836+
if(False): # profile code
18371837
import cProfile
18381838
cProfile.run('mainWindow = MainWindow(preferences)', 'profile.txt')
18391839
##########################################
18401840
##########################################
18411841
# Use this in python console!
1842-
#import pstats
1843-
#p = pstats.Stats('profile.txt')
1844-
#p.sort_stats('cumulative').print_stats(10)
1845-
#p.sort_stats('time').print_stats(10)
1842+
# import pstats
1843+
# p = pstats.Stats('profile.txt')
1844+
# p.sort_stats('cumulative').print_stats(10)
1845+
# p.sort_stats('time').print_stats(10)
18461846
##########################################
18471847
##########################################
18481848
else:

0 commit comments

Comments
 (0)