def identify(self): idx=self.acTree.selectedIndexes()[0] if not idx.isValid(): print "Error, index is not valid" return p = idx.parent() if p.data().toString() in ("fragments/adducts:","isotopic cluster:"): p = idx.parent().parent().parent() sample=self.currentSample[1 if self.acTree is self.view.treeView_2 else 2]#self.model.sample(p.data().toString(), fullNameEntry=False) if sample is None: print "Error, sample not found %s"%sample.shortName() return #data=None if len(idx.data().toString().split('/')) > 2: data=idx.data().toString().split('/')[:-1] else: data=idx.data().toString().split('/') peak=sample.peakAt(*map(float, data)) if peak is None: self.view.showErrorMessage("Error", "Unable to find the corresponding peak...") spl=MSSampleList() s=MSSample("None") s.rawPeaks=MSPeakList([peak], sample=s) spl.addSample(s) dial=MSIdentificationDialog(parent=self.view) dial.setAttribute(Qt.WA_DeleteOnClose) controller=MSIdentificationController(spl, dial, False, showDirectResult=True)
def merge(filenames): sampleList = MSSampleList(kind='MRM') n = [s.split('-')[-1].split('.')[0][1:] for s in filenames] print n for f in filenames: s = MSSample(os.path.normcase(f), kind='MRM') s.loadMZXMLData() sampleList.append(s) mergedSampleName = "-".join(n) + ".mzXML" createMergedXml(mergedSampleName, sampleList)
def merge(filenames): sampleList = MSSampleList(kind='MRM') n = [s.split('-')[-1].split('.')[0][1:] for s in filenames] print n for f in filenames: s = MSSample(os.path.normcase(f), kind='MRM') s.loadMZXMLData() sampleList.append(s) mergedSampleName = "-".join(n)+".mzXML" createMergedXml(mergedSampleName, sampleList)
def getElementsToPlot(self, flags="chroma", prec=None, rt=None, index=None): """ think about giving only index;should be lot simpler flags: @chroma: TIC in FACT for both MRM and highRes @peak: peak return Eic objects... @spectra: return spectra objects """ if flags == "chroma": return [spl.chroma[0] for spl in self.model if spl.checked] elif flags == 'peak': return MSSampleList([spl for spl in self.model if spl.checked]).peakGroup(prec, rt) elif flags == 'spectra': if index is not None: l = [] for spl in self.model: try: #if qApp.instance().lowMemory: # l.append(spl.loadSpectrum(index)) #else: l.append(spl.spectra[index]) except IndexError: pass return l
def identify(self): idx = self.acTree.selectedIndexes()[0] if not idx.isValid(): print "Error, index is not valid" return p = idx.parent() if p.data().toString() in ("fragments/adducts:", "isotopic cluster:"): p = idx.parent().parent().parent() sample = self.currentSample[ 1 if self.acTree is self.view.treeView_2 else 2] #self.model.sample(p.data().toString(), fullNameEntry=False) if sample is None: print "Error, sample not found %s" % sample.shortName() return #data=None if len(idx.data().toString().split('/')) > 2: data = idx.data().toString().split('/')[:-1] else: data = idx.data().toString().split('/') peak = sample.peakAt(*map(float, data)) if peak is None: self.view.showErrorMessage( "Error", "Unable to find the corresponding peak...") spl = MSSampleList() s = MSSample("None") s.rawPeaks = MSPeakList([peak], sample=s) spl.addSample(s) dial = MSIdentificationDialog(parent=self.view) dial.setAttribute(Qt.WA_DeleteOnClose) controller = MSIdentificationController(spl, dial, False, showDirectResult=True)
def buildGui(self): STEP = 4 #if self.showSplash: self.splash.showMessage((u'Loading core objects...'), Qt.AlignCenter | Qt.AlignBottom, Qt.black) from core.MetObjects import MSSampleList self.model = MSSampleList() from pluginmanager.MetPluginFactory import MSPluginManager self.pluginManager = MSPluginManager(self) plugs = self.pluginManager.getAvailablePlugins() self.splash.showMessage((u'Loading task manager...'), Qt.AlignCenter | Qt.AlignBottom, Qt.black) from controller.MetBaseControl import MSTaskManager self.taskManager = MSTaskManager() self.splash.setValue(100. / STEP) #if self.showSplash: self.splash.showMessage((u'Loading gui files...'), Qt.AlignCenter | Qt.AlignBottom, Qt.black) from gui.MetMainGui import MSMainWindow self.view = MSMainWindow(plugs) def closeEvent(e): self.writeSettings() e.accept() self.view.closeEvent = closeEvent self.view.setWindowIcon( QIcon(QPixmap(path.normcase("gui/icons/deluge.png")))) self.view.setWindowTitle(u' '.join( [self.APPLICATION_NAME_STR, self.VERSION_STR])) self.splash.setValue(2 * (100. / STEP)) #if self.showSplash: self.splash.showMessage((u'Loading controllers...'), Qt.AlignCenter | Qt.AlignBottom, Qt.black) from controller.MetDockWidgetControl import MSDockController from controller.MetMenuBarControl import MSMenuController from controller.MetMdiControl import MSMdiAreaController self.menuControl = MSMenuController(self.model, self.view) self.dockControl = MSDockController(self.model, self.view) self.mdiControl = MSMdiAreaController(self.model, self.view) self.splash.setValue(3 * (100. / STEP)) #if self.showSplash: #self.splash.showMessage((u'Loading plugins...'), Qt.AlignCenter|Qt.AlignBottom, Qt.black) #the following allow to delete threads and controllers #it is very important ;) #self.connect(self, SIGNAL('deleteLastController()'), self.taskManager.deleteController) self.splash.setValue(4 * (100. / STEP)) self.splash.showMessage((u'Loading last parameters...'), Qt.AlignCenter | Qt.AlignBottom, Qt.black) if self.settings.value("fullScreen", True).toBool(): self.view.showMaximized() else: self.view.resize( self.settings.value("size", QSize(600, 600)).toSize()) self.view.move( self.settings.value("pos", QPoint(200, 200)).toPoint()) self.view.show() self.splash.finish(self.view)