Ejemplo n.º 1
0
    def __init__(self, data, title, flags="chroma", parent=None, **k):
        QWidget.__init__(self, parent)
        MSDialogController.__init__(self, 0, parent)

        self.model = self.qApp.model
        self.view = self.qApp.view

        self.data = data
        self.title = title
        self.flags = flags

        if self.flags == 'peak':
            if self.acTree not in (self.view.treeView_2, self.view.treeView_3):
                print "Unknown Error"
                return
            idx = self.acTree.selectedIndexes()[0]
            s = qApp.instance().dockControl.currentSample[
                1 if self.acTree is self.view.treeView_2 else 2]
            if s is None:
                print "unknow error"
                return
            values = map(float, idx.data().toString().split('/')[:2])
            self.currentPeak = s.peakAt(*values)
            #connection to update the selected Peak object
            self.connect(self.acTree, SIGNAL("changedLine"),
                         self.updateCurrentPeak)

        self.minX, self.maxX, self.maxY = [0] * 3
        #if flags != 'peak':
        #    self.minX, self.maxX, self.maxY = self.getMax()
        self.pw = PlotWidget(self.minX, self.maxX, self.maxY, parent=self,
                             **k)  #parent=self,
        #self.pw.setAttribute(Qt.WA_DeleteOnClose)#plotItem.setAttribute(Qt.WA_PaintOnScreen & Qt.WA_PaintUnclipped)
        if k.get('antialiased', False):
            self.pw.setRenderHint(0x01)  #antialiasing i suppose
        self.pw.setTitle(title)
        self.pw.updateGrid()

        self._setupUi()

        self.connect(self, SIGNAL('linePlotted'), self.updateContextMenu)
        self.connect(self.view.sampleTableView,
                     SIGNAL("disHighlightRequested(QModelIndex)"),
                     self.disHighlightOne)
        self.connect(self.view.sampleTableView,
                     SIGNAL("highlightRequested(QModelIndex)"), self.highlight)
        self.connect(self.view.sampleTableView,
                     SIGNAL("noHighlightRequested()"), self.disHighlight)
        self.connect(self.view.ppmEditer, SIGNAL('valueChanged(double)'),
                     self.redrawAll)

        self.drawnItems = {}
        self.trashItems = []  #why unecessary? nope to collect annotation stuff
        self.textLabels = []
        self.pixmaps = []
        self.dataPoints = None

        self._plotting(self.data)  #initial plotting
Ejemplo n.º 2
0
 def __init__(self,lspl, win, creation):
     MSDialogController.__init__(self, lspl, win, creation)
     QObject.connect(self.view.lineEdit, SIGNAL("textChanged(const QString &)"), self.checkLineEdit)
     if paramikoSupport:
         try:
             QObject.connect(self.view.parallel, SIGNAL("clicked()"), self.showSSHConnect)
         except AttributeError:
             pass
     self.checkLineEdit("")
     self.view.exec_()
Ejemplo n.º 3
0
 def setModels(self):
     """Add the model to the view when the thread ended"""
     
     if self.showDirectResult:        
         table = QTableView()
         view = MSTableView(table, model=self.buildModel(self.sampleList[0].rawPeaks[0]), selection=True)
         self.qApp.view.addMdiSubWindow(view, "identification of mapped peaks of %s"%self.sampleList[0].shortName())
     
     currentSample = self.qApp.dockControl.currentSample[2]
     if currentSample is not None:
         MSDialogController.actualizeClusterModel(currentSample)
     self.qApp.view.showInformationMessage("Job Done", "Identification is done !")
Ejemplo n.º 4
0
 def startTask(self):    
     """
     Main Function
     
     """                
     MSDialogController.startTask(self)
     self.task= MSIdThread(self.sampleList, **self.parameters)
     QObject.connect(self.view, SIGNAL('destroyed(QObject *)'), self.task.begin)
     QObject.connect(self.task, SIGNAL("started()"),self.qApp.view.to_indetermined_mode)
     QObject.connect(self.task, SIGNAL("finished()"), self.qApp.view.to_determined_mode)
     QObject.connect(self.task, SIGNAL("finished()"), self.setModels)
     self.view.close()
Ejemplo n.º 5
0
 def __init__(self, lspl, win, creation):
     MSDialogController.__init__(self, lspl, win, creation)
     QObject.connect(self.view.lineEdit,
                     SIGNAL("textChanged(const QString &)"),
                     self.checkLineEdit)
     if paramikoSupport:
         try:
             QObject.connect(self.view.parallel, SIGNAL("clicked()"),
                             self.showSSHConnect)
         except AttributeError:
             pass
     self.checkLineEdit("")
     self.view.exec_()
Ejemplo n.º 6
0
    def __init__(self, data, title, flags="chroma", parent=None, **k):
        QWidget.__init__(self, parent)
        MSDialogController.__init__(self, 0, parent)
        
        self.model = self.qApp.model
        self.view =  self.qApp.view
      
        self.data=data
        self.title=title
        self.flags=flags
        
        if self.flags == 'peak':
            if self.acTree not in (self.view.treeView_2, self.view.treeView_3):
                print "Unknown Error"
                return
            idx=self.acTree.selectedIndexes()[0]
            s = qApp.instance().dockControl.currentSample[1 if self.acTree is self.view.treeView_2 else 2]
            if s is None:
                print "unknow error"
                return            
            values = map(float, idx.data().toString().split('/')[:2])
            self.currentPeak = s.peakAt(*values)
            #connection to update the selected Peak object
            self.connect(self.acTree, SIGNAL("changedLine"), self.updateCurrentPeak)
        
        self.minX, self.maxX, self.maxY  = [0] * 3
        #if flags != 'peak':
        #    self.minX, self.maxX, self.maxY = self.getMax()
        self.pw = PlotWidget(self.minX, self.maxX, self.maxY,  parent=self, **k)#parent=self,
        #self.pw.setAttribute(Qt.WA_DeleteOnClose)#plotItem.setAttribute(Qt.WA_PaintOnScreen & Qt.WA_PaintUnclipped)
        if k.get('antialiased', False):
            self.pw.setRenderHint(0x01)#antialiasing i suppose
        self.pw.setTitle(title)
        self.pw.updateGrid()

        
        self._setupUi()        
        
        self.connect(self, SIGNAL('linePlotted'), self.updateContextMenu)
        self.connect(self.view.sampleTableView, SIGNAL("disHighlightRequested(QModelIndex)"), self.disHighlightOne)
        self.connect(self.view.sampleTableView, SIGNAL("highlightRequested(QModelIndex)"), self.highlight)
        self.connect(self.view.sampleTableView, SIGNAL("noHighlightRequested()"), self.disHighlight)
        self.connect(self.view.ppmEditer, SIGNAL('valueChanged(double)'), self.redrawAll)
        
        self.drawnItems = {} 
        self.trashItems=[]#why unecessary? nope to collect annotation stuff
        self.textLabels = []
        self.pixmaps = []
        self.dataPoints = None
        
        self._plotting(self.data)#initial plotting
Ejemplo n.º 7
0
 def __init__(self, lspl, visu, creation, showDirectResult=False):
     """
     constructor 
     
     """
     #data needed to process
     MSDialogController.__init__(self, lspl, visu, creation)
     self.databases ={"KEGG":None,
                      "METJP":None, 
                      "BIOCYC":None,
                      "METEXPLORE":None}
     QObject.connect(self.view.checkBox_8, SIGNAL('toggled(bool)'), self._update)
     self._update(True)#initializing to metexplore so we keep enabled
     self.showDirectResult = showDirectResult        
     
     self.view.exec_()
Ejemplo n.º 8
0
 def showClusterTable(self):
     if not self.view.sampleTableView.selectedIndexes(
     ):  #not self.acTree.selectedIndexes():
         s, b = QInputDialog.getItem(
             self.view, "Select one sample", "Select one sample :",
             [spl.shortName() for spl in self.model])
         if not b:
             return
         sample = self.model.sample(str(s), fullNameEntry=False)
     else:
         idx = self.view.sampleTableView.selectedIndexes()[0]
         sample = self.model.sample(idx.data().toString(),
                                    fullNameEntry=False)
     if sample is None:
         print("sample not found...")
         return
     if not sample.mappedPeaks:
         self.view.showErrorMessage(
             "No peaks found",
             "This sample does not have peaks, please do peak picking before"
         )
     view = QTableView()
     view.setSortingEnabled(True)
     view.horizontalHeader().setStretchLastSection(True)
     view.setModel(
         MSDialogController.getSampleModel(sample, flags='cluster'))
     self.view.addMdiSubWindow(view,
                               "ClusterList of%s" % str(sample.shortName()))
Ejemplo n.º 9
0
 def showPeakTable(self):
     """
     TODO: write little function to check if sample is None or good
     or write exception with good code
     
     """
     if not self.view.sampleTableView.selectedIndexes(
     ):  #not self.acTree.selectedIndexes():
         s, b = QInputDialog.getItem(
             self.view, "Select one sample", "Select one sample :",
             [spl.shortName() for spl in self.model])
         if not b:
             return
         sample = self.model.sample(str(s), fullNameEntry=False)
     else:
         idx = self.view.sampleTableView.selectedIndexes()[0]
         sample = self.model.sample(idx.data().toString(),
                                    fullNameEntry=False)
     if sample is None:
         print("sample not found...")
         return
     if not sample.rawPeaks:
         self.view.showErrorMessage(
             "No peaks found",
             "This sample does not have peaks, please do peak picking before"
         )
     view = QTableView()
     view.horizontalHeader().setStretchLastSection(True)
     view.setSortingEnabled(True)
     model = MSDialogController.getSampleModel(sample, flags='peak')
     view.setModel(model)
     self.view.addMdiSubWindow(
         view, " ".join(["PeakList of",
                         str(sample.shortName())]))
Ejemplo n.º 10
0
 def startTask(self):  
     MSDialogController.startTask(self)
     self.task = MSIntegrationThread(self.sampleList, **self.parameters)
     
     def begin():
         self.view=None
         self.task.start()
         self.task.exec_()
     self.task.begin = begin
     
     #to avoid QObject::killTimers error, wait for the dialog to be deleted
     QObject.connect(self.view, SIGNAL('destroyed(QObject *)'), self.task.begin)
     QObject.connect(self.task, SIGNAL("started()"),qApp.instance().view.to_indetermined_mode)
     QObject.connect(self.task, SIGNAL("finished()"),self.setModels)
     QObject.connect(self.task, SIGNAL("finished()"),qApp.instance().view.to_determined_mode)
     self.view.close()
Ejemplo n.º 11
0
 def __init__(self, lspl, visu, creation):
     MSDialogController.__init__(self, lspl, visu, creation)
     self.polarity=1 #initialisation
     if not self.model:
         self.goodIdx = 0
     else:
         self.goodIdx = 0 if self.model[0].kind == 'HighRes' else 1
     
     self.populateTableViews(self.polarity)
     self.allAddsChecked = False
     self.allFragsChecked = False
     QObject.connect(self.view.posmode, SIGNAL('toggled(bool)'), self.updatePolarity)
     QObject.connect(self.view.checkAllAdds, SIGNAL('clicked()'), self.checkAdds)
     QObject.connect(self.view.checkAllFrags, SIGNAL('clicked()'), self.checkFrags)
     
     self.view.exec_()
Ejemplo n.º 12
0
 def showPeakTable(self):
     """
     TODO: write little function to check if sample is None or good
     or write exception with good code
     
     """
     if not self.view.sampleTableView.selectedIndexes():#not self.acTree.selectedIndexes():
         s, b = QInputDialog.getItem(self.view, "Select one sample", "Select one sample :", 
                                  [spl.shortName() for spl in self.model])
         if not b:
             return
         sample = self.model.sample(str(s), fullNameEntry=False)
     else:
         idx = self.view.sampleTableView.selectedIndexes()[0]
         sample = self.model.sample(idx.data().toString(), fullNameEntry=False)
     if sample is None:
         print ("sample not found...")
         return
     if not sample.rawPeaks:
         self.view.showErrorMessage("No peaks found", 
                                    "This sample does not have peaks, please do peak picking before")
     view=QTableView()
     view.horizontalHeader().setStretchLastSection(True)
     view.setSortingEnabled(True)
     model=MSDialogController.getSampleModel(sample, flags='peak')
     view.setModel(model)           
     self.view.addMdiSubWindow(view, " ".join(["PeakList of", str(sample.shortName())]))
Ejemplo n.º 13
0
 def startTask(self):
     """
     Main Function (model function) Clustering
     
     """
     MSDialogController.startTask(self)
     #qApp.instance().view.showInStatusBar("Clustering Step...Please Wait..",  5000)
     self.task = MSClusterThread(self.sampleList, **self.parameters)
     QObject.connect(self.view, SIGNAL('destroyed(QObject *)'), self.task.begin)
     #self.connect(self.view, SIGNAL('destroyed(QObject *)'), self.setViewToNone)
     QObject.connect(self.task, SIGNAL("started()"),qApp.instance().view.to_determined_mode)
     QObject.connect(self.task, SIGNAL('update_pb'), qApp.instance().view.updateProgressBar)
     #QObject.connect(self.task, SIGNAL("finished()"),qApp.instance().view.to_determined_mode)
     QObject.connect(self.task, SIGNAL("finished()"), self.setModels)
     #print "about to close"
     self.view.close()
Ejemplo n.º 14
0
 def setModels(self):
     """
     end processing 
     
     """
     qApp.instance().view.comparativeTableView.setModel(MSDialogController.actualizePeakModelComparative())
     qApp.instance().view.showInformationMessage("Integration Done", "Integration process finished...")
     qApp.instance().view.tabWidget.setCurrentIndex(1)
Ejemplo n.º 15
0
 def startTask(self):
     """
     Main Function (model function) Clustering
     
     """
     MSDialogController.startTask(self)
     #qApp.instance().view.showInStatusBar("Clustering Step...Please Wait..",  5000)
     self.task = MSClusterThread(self.sampleList, **self.parameters)
     QObject.connect(self.view, SIGNAL('destroyed(QObject *)'),
                     self.task.begin)
     #self.connect(self.view, SIGNAL('destroyed(QObject *)'), self.setViewToNone)
     QObject.connect(self.task, SIGNAL("started()"),
                     qApp.instance().view.to_determined_mode)
     QObject.connect(self.task, SIGNAL('update_pb'),
                     qApp.instance().view.updateProgressBar)
     #QObject.connect(self.task, SIGNAL("finished()"),qApp.instance().view.to_determined_mode)
     QObject.connect(self.task, SIGNAL("finished()"), self.setModels)
     #print "about to close"
     self.view.close()
Ejemplo n.º 16
0
    def __init__(self, lspl, visu, creation):
        MSDialogController.__init__(self, lspl, visu, creation)
        self.polarity = 1  #initialisation
        if not self.model:
            self.goodIdx = 0
        else:
            self.goodIdx = 0 if self.model[0].kind == 'HighRes' else 1

        self.populateTableViews(self.polarity)
        self.allAddsChecked = False
        self.allFragsChecked = False
        QObject.connect(self.view.posmode, SIGNAL('toggled(bool)'),
                        self.updatePolarity)
        QObject.connect(self.view.checkAllAdds, SIGNAL('clicked()'),
                        self.checkAdds)
        QObject.connect(self.view.checkAllFrags, SIGNAL('clicked()'),
                        self.checkFrags)

        self.view.exec_()
Ejemplo n.º 17
0
 def setModels(self):
     """
     end processing 
     
     """
     qApp.instance().view.comparativeTableView.setModel(
         MSDialogController.actualizePeakModelComparative())
     qApp.instance().view.showInformationMessage(
         "Integration Done", "Integration process finished...")
     qApp.instance().view.tabWidget.setCurrentIndex(1)
Ejemplo n.º 18
0
    def startTask(self):
        MSDialogController.startTask(self)
        self.task = MSIntegrationThread(self.sampleList, **self.parameters)

        def begin():
            self.view = None
            self.task.start()
            self.task.exec_()

        self.task.begin = begin

        #to avoid QObject::killTimers error, wait for the dialog to be deleted
        QObject.connect(self.view, SIGNAL('destroyed(QObject *)'),
                        self.task.begin)
        QObject.connect(self.task, SIGNAL("started()"),
                        qApp.instance().view.to_indetermined_mode)
        QObject.connect(self.task, SIGNAL("finished()"), self.setModels)
        QObject.connect(self.task, SIGNAL("finished()"),
                        qApp.instance().view.to_determined_mode)
        self.view.close()
Ejemplo n.º 19
0
 def resize():
     s = str(d.comboBox.currentText())
     min_, max_ = map(float, str(d.lineEdit.text()).split('-'))
     d.close()
     if s == 'All':
         if any([spl.rawPeaks for spl in self.model]):
             self.view.showErrorMessage("Error", 
                                        "Can not resize sample when peak picking has already been done")
         for sample in self.model:
             print "Resize %s"%sample.shortName()
             sample.resizeSpectraLength(min_, max_)
     else:
         sample = self.model.sample(s, fullNameEntry=False)
         if sample.rawPeaks:
             self.view.showErrorMessage("Error", 
                                        "Can not resize sample when peak picking has already been done")                    
         sample.resizeSpectraLength(min_, max_)
     for tree in (self.view.treeView, self.view.treeView_2, self.view.treeView_3):
         tree.removeAll()
     for spl in self.model:
         MSDialogController.actualizeSpectraModel(spl)
     self.view.showInformationMessage("Done", "Resizing has been done !")
Ejemplo n.º 20
0
 def  redo(self):
     m = QApplication.instance().model
     if self.rawData:
         m.alignRawData(m)
     else:
         m.alignPeaksInRTDimension(m, self.polyDegree, self.errorRt)
     for tree in (qApp.instance().view.treeView, qApp.instance().view.treeView_2, qApp.instance().view.treeView_3):
         tree.removeAll()
     for spl in qApp.instance().model:
         MSDialogController.actualizeSpectraModel(spl)
         if spl.rawPeaks:
             MSDialogController.actualizePeakModel(spl)
         if spl.mappedPeaks:
             MSDialogController.actualizeClusterModel(spl)
     qApp.instance().view.showInformationMessage('Alignment calculation done', "Alignment done")
Ejemplo n.º 21
0
 def showClusterTable(self):
     if not self.view.sampleTableView.selectedIndexes():#not self.acTree.selectedIndexes():
         s, b = QInputDialog.getItem(self.view, "Select one sample", "Select one sample :", 
                                  [spl.shortName() for spl in self.model])
         if not b:
             return
         sample = self.model.sample(str(s), fullNameEntry=False)
     else:
         idx = self.view.sampleTableView.selectedIndexes()[0]
         sample = self.model.sample(idx.data().toString(), fullNameEntry=False)
     if sample is None:
         print ("sample not found...")
         return
     if not sample.mappedPeaks:
         self.view.showErrorMessage("No peaks found", 
                                    "This sample does not have peaks, please do peak picking before")
     view= QTableView()
     view.setSortingEnabled(True)
     view.horizontalHeader().setStretchLastSection(True)
     view.setModel(MSDialogController.getSampleModel(sample, flags='cluster'))
     self.view.addMdiSubWindow(view, "ClusterList of%s"%str(sample.shortName()))
Ejemplo n.º 22
0
 def actualizeModels(self, idx):
     """
     will update several models to fit with the selected
     sample
     
     """
     sample = self.model.sample(idx.data().toString(), fullNameEntry=False)
     if sample is None:
         return
     self.qApp.view.sampleDockWidget.cursor().setShape(Qt.WaitCursor)
     MSDialogController.actualizeSpectraModel(sample)
     self.setCurrentSample(sample, 1)
     if sample.rawPeaks:
         MSDialogController.actualizePeakModel(sample)
         self.setCurrentSample(sample, 2)
     if sample.mappedPeaks:
         MSDialogController.actualizeClusterModel(sample)
         self.setCurrentSample(sample, 3)
     self.qApp.view.sampleDockWidget.cursor().setShape(Qt.ArrowCursor)        
Ejemplo n.º 23
0
 def actualizeModels(self, idx):
     """
     will update several models to fit with the selected
     sample
     
     """
     sample = self.model.sample(idx.data().toString(), fullNameEntry=False)
     if sample is None:
         return
     self.qApp.view.sampleDockWidget.cursor().setShape(Qt.WaitCursor)
     MSDialogController.actualizeSpectraModel(sample)
     self.setCurrentSample(sample, 1)
     if sample.rawPeaks:
         MSDialogController.actualizePeakModel(sample)
         self.setCurrentSample(sample, 2)
     if sample.mappedPeaks:
         MSDialogController.actualizeClusterModel(sample)
         self.setCurrentSample(sample, 3)
     self.qApp.view.sampleDockWidget.cursor().setShape(Qt.ArrowCursor)