23
23
__copyright__ = 'Copyright 2013'
24
24
__credits__ = ['Donovan Parks' ]
25
25
__license__ = 'GPL3'
26
- __version__ = '2.0.8 '
27
- __date__ = 'August 4 , 2014'
26
+ __version__ = '2.0.9 '
27
+ __date__ = 'December 5 , 2014'
28
28
__maintainer__ = 'Donovan Parks'
29
29
30
30
__status__ = 'Development'
35
35
import string
36
36
37
37
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
39
39
40
40
from PyQt4 import QtGui , QtCore
41
41
@@ -200,7 +200,7 @@ def __init__(self, preferences, parent=None):
200
200
201
201
self .metadata = None
202
202
203
- #self.loadProfile() # *** For debugging purposes
203
+ # self.loadProfile() # *** For debugging purposes
204
204
205
205
def propertiesTabChanged (self , currentIndex ):
206
206
self .ui .stackedWidgetViews .setCurrentIndex (currentIndex )
@@ -691,7 +691,7 @@ def group1ColourDlg(self):
691
691
if colour .isValid ():
692
692
self .setGroup1Colour (colour )
693
693
694
- def setGroup1Colour (self , colour , bUpdatePlot = True ):
694
+ def setGroup1Colour (self , colour , bUpdatePlot = True ):
695
695
colourStr = str (colour .red ()) + ',' + str (colour .green ()) + ',' + str (colour .blue ())
696
696
self .ui .btnGroup1Colour .setStyleSheet ('* { background-color: rgb(' + colourStr + ') }' )
697
697
self .preferences ['Group colours' ][self .groupProfile .groupName1 ] = colour
@@ -706,7 +706,7 @@ def group2ColourDlg(self):
706
706
if colour .isValid ():
707
707
self .setGroup2Colour (colour )
708
708
709
- def setGroup2Colour (self , colour , bUpdatePlot = True ):
709
+ def setGroup2Colour (self , colour , bUpdatePlot = True ):
710
710
colourStr = str (colour .red ()) + ',' + str (colour .green ()) + ',' + str (colour .blue ())
711
711
self .ui .btnGroup2Colour .setStyleSheet ('* { background-color: rgb(' + colourStr + ') }' )
712
712
self .preferences ['Group colours' ][self .groupProfile .groupName2 ] = colour
@@ -757,7 +757,7 @@ def loadProfile(self):
757
757
QtGui .QMessageBox .information (self , 'Error reading profile file' , errMsg , QtGui .QMessageBox .Warning )
758
758
return
759
759
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 )
761
761
return
762
762
763
763
self .metadata = None
@@ -800,7 +800,7 @@ def loadProfile(self):
800
800
# indicate the hierarchical level of interest has changed
801
801
bGroupLegendVisibility = self .groupLegendDlg .isVisible ()
802
802
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!
804
804
805
805
self .multiGroupHierarchicalLevelsChanged ()
806
806
self .groupHierarchicalLevelsChanged ()
@@ -829,7 +829,7 @@ def populateGroupComboBoxes(self):
829
829
830
830
def parentLevelChanged (self ):
831
831
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 ()))
833
833
if parentDepth >= profileDepth :
834
834
QtGui .QMessageBox .information (self , 'Invalid profile' , 'The parent level must be higher in the hierarchy than the profile level.' , QtGui .QMessageBox .Warning )
835
835
self .ui .cboParentalLevel .setCurrentIndex (0 )
@@ -840,11 +840,11 @@ def parentLevelChanged(self):
840
840
841
841
def profileLevelChanged (self ):
842
842
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 ()))
844
844
845
845
if profileDepth <= parentDepth :
846
846
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 )
848
848
return
849
849
850
850
self .sampleHierarchicalLevelsChanged ()
@@ -874,7 +874,7 @@ def sampleHierarchicalLevelsChanged(self):
874
874
profileIndex = self .profileTree .hierarchyHeadings .index (profileHeading )
875
875
self .ui .cboSampleHighlightHierarchy .clear ()
876
876
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 ]:
878
878
self .ui .cboSampleHighlightHierarchy .addItem (header )
879
879
self .ui .cboSampleHighlightHierarchy .setCurrentIndex (0 )
880
880
@@ -911,7 +911,7 @@ def groupHierarchicalLevelsChanged(self):
911
911
profileIndex = self .profileTree .hierarchyHeadings .index (profileHeading )
912
912
self .ui .cboGroupHighlightHierarchy .clear ()
913
913
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 ]:
915
915
self .ui .cboGroupHighlightHierarchy .addItem (header )
916
916
self .ui .cboGroupHighlightHierarchy .setCurrentIndex (0 )
917
917
@@ -940,7 +940,7 @@ def multiGroupHierarchicalLevelsChanged(self):
940
940
profileIndex = self .profileTree .hierarchyHeadings .index (profileHeading )
941
941
self .ui .cboMultiGroupHighlightHierarchy .clear ()
942
942
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 ]:
944
944
self .ui .cboMultiGroupHighlightHierarchy .addItem (header )
945
945
self .ui .cboMultiGroupHighlightHierarchy .setCurrentIndex (0 )
946
946
@@ -977,7 +977,7 @@ def groupFeaturesTableUpdate(self):
977
977
self .preferences ['Selected group feature' ] = ''
978
978
979
979
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
981
981
982
982
self .ui .tableGroupFeatures .horizontalHeader ().setStretchLastSection (True )
983
983
self .ui .tableGroupFeatures .setModel (self .groupFeatureTable )
@@ -1007,7 +1007,7 @@ def multiGroupFeaturesTableUpdate(self):
1007
1007
self .preferences ['Selected multiple group feature' ] = ''
1008
1008
1009
1009
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
1011
1011
1012
1012
self .ui .tableMultiGroupFeatures .horizontalHeader ().setStretchLastSection (True )
1013
1013
self .ui .tableMultiGroupFeatures .setModel (self .multiGroupFeatureTable )
@@ -1045,7 +1045,7 @@ def sampleRunTest(self):
1045
1045
self .ui .cboUnclassified .currentText ())
1046
1046
1047
1047
# 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 )
1049
1049
progress .setWindowTitle ('Progress' )
1050
1050
progress .setWindowModality (QtCore .Qt .WindowModal )
1051
1051
progress .setVisible (True )
@@ -1093,7 +1093,7 @@ def groupRunTest(self):
1093
1093
self .setGroup2Colour (self .preferences ['All other samples colour' ])
1094
1094
1095
1095
# 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 )
1097
1097
progress .setWindowTitle ('Progress' )
1098
1098
progress .setWindowModality (QtCore .Qt .WindowModal )
1099
1099
progress .setVisible (True )
@@ -1133,7 +1133,7 @@ def multiGroupRunTest(self):
1133
1133
1134
1134
if len (self .multiGroupProfile .activeGroupNames ) >= 2 :
1135
1135
# 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 )
1137
1137
progress .setWindowTitle ('Progress' )
1138
1138
progress .setWindowModality (QtCore .Qt .WindowModal )
1139
1139
progress .setVisible (True )
@@ -1558,7 +1558,7 @@ def sampleHighlightHierarchyChanged(self):
1558
1558
featureStrList .append (feature )
1559
1559
1560
1560
self .ui .cboSampleHighlightFeature .clear ()
1561
- self .ui .cboSampleHighlightFeature .insertItems (len (featureStrList ),featureStrList )
1561
+ self .ui .cboSampleHighlightFeature .insertItems (len (featureStrList ), featureStrList )
1562
1562
self .ui .cboSampleHighlightFeature .setCurrentIndex (0 )
1563
1563
1564
1564
self .ui .cboSampleHighlightFeature .adjustSize ()
@@ -1586,7 +1586,7 @@ def groupHighlightHierarchyChanged(self):
1586
1586
featureStrList .append (feature )
1587
1587
1588
1588
self .ui .cboGroupHighlightFeature .clear ()
1589
- self .ui .cboGroupHighlightFeature .insertItems (len (featureStrList ),featureStrList )
1589
+ self .ui .cboGroupHighlightFeature .insertItems (len (featureStrList ), featureStrList )
1590
1590
self .ui .cboGroupHighlightFeature .setCurrentIndex (0 )
1591
1591
1592
1592
self .ui .cboGroupHighlightFeature .adjustSize ()
@@ -1614,7 +1614,7 @@ def multiGroupHighlightHierarchyChanged(self):
1614
1614
featureStrList .append (feature )
1615
1615
1616
1616
self .ui .cboMultiGroupHighlightFeature .clear ()
1617
- self .ui .cboMultiGroupHighlightFeature .insertItems (len (featureStrList ),featureStrList )
1617
+ self .ui .cboMultiGroupHighlightFeature .insertItems (len (featureStrList ), featureStrList )
1618
1618
self .ui .cboMultiGroupHighlightFeature .setCurrentIndex (0 )
1619
1619
1620
1620
self .ui .cboMultiGroupHighlightFeature .adjustSize ()
@@ -1691,7 +1691,7 @@ def saveImageDlg(self):
1691
1691
if f != '' :
1692
1692
self .preferences ['Last directory' ] = f [0 :f .lastIndexOf ('/' )]
1693
1693
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' :
1695
1695
dpi , ok = QtGui .QInputDialog .getInteger (self , 'Desired resolution' , 'Enter desired resolution (DPI) of image:' , 300 )
1696
1696
if ok :
1697
1697
plotToSave .save (str (f ), dpi )
@@ -1760,28 +1760,28 @@ def closeEvent(self, event):
1760
1760
settings .setValue ('Preferences/Minimum reported p-value exponent' , self .preferences ['Minimum reported p-value exponent' ])
1761
1761
1762
1762
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.
1766
1766
1767
1767
import traceback
1768
1768
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 ):
1772
1772
if qApp ():
1773
1773
qApp ().quit ()
1774
1774
return
1775
1775
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 )
1779
1779
1780
1780
QtGui .QMessageBox .critical (None , "Unknown error..." ,
1781
1781
"<center>An error has occured:<br/><br/>"
1782
1782
+ "<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>" )
1785
1785
1786
1786
def main ():
1787
1787
# ignore numpy warnings as invalid results are handled within STAMP
@@ -1816,7 +1816,7 @@ def main():
1816
1816
workingDir = getMainDir ()
1817
1817
preferences ['Last directory' ] = ''
1818
1818
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' )]
1820
1820
preferences ['Last directory' ] = workingDir
1821
1821
os .chdir (workingDir )
1822
1822
@@ -1826,23 +1826,23 @@ def main():
1826
1826
# the program icon is displayed in the taskbar instead of the generic
1827
1827
# Python icon.
1828
1828
import ctypes
1829
- myappid = 'beikolab.software.stamp.2' # arbitrary string
1829
+ myappid = 'beikolab.software.stamp.2' # arbitrary string
1830
1830
ctypes .windll .shell32 .SetCurrentProcessExplicitAppUserModelID (myappid )
1831
1831
1832
1832
if (platform .system () == 'Windows' and len (sys .argv ) == 1 ) or (platform .system () != 'Windows' and len (sys .argv ) <= 2 ):
1833
1833
sys .excepthook = exceptHook
1834
1834
app = QtGui .QApplication (sys .argv )
1835
1835
1836
- if (False ): # profile code
1836
+ if (False ): # profile code
1837
1837
import cProfile
1838
1838
cProfile .run ('mainWindow = MainWindow(preferences)' , 'profile.txt' )
1839
1839
##########################################
1840
1840
##########################################
1841
1841
# 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)
1846
1846
##########################################
1847
1847
##########################################
1848
1848
else :
0 commit comments