Beispiel #1
0
    def onSave(self, evt):
        """Save current pattern as doument."""

        # check data
        if self.currentPatternScan == None or self.currentCompound == None:
            wx.Bell()
            return

        # get ion
        if self.currentIon != None:
            charge = self.currentIon[3]
            ion = self.currentIon[4]
        else:
            charge = 0
            ion = '[M]'

        # make document
        document = doc.document()
        document.dirty = True
        document.title = '%s %s' % (self.currentCompound.formula(), ion)
        document.spectrum = copy.deepcopy(self.currentPatternScan)

        # make annotations
        mass = self.currentCompound.mass()
        mz = self.currentCompound.mz(
            charge=charge,
            agentFormula=config.massCalculator['ionseriesAgent'],
            agentCharge=config.massCalculator['ionseriesAgentCharge'])
        document.annotations.append(
            doc.annotation(label='monoisotopic m/z',
                           mz=mz[0],
                           ai=config.massCalculator['patternIntensity'],
                           base=config.massCalculator['patternBaseline']))
        document.annotations.append(
            doc.annotation(label='average m/z',
                           mz=mz[1],
                           ai=config.massCalculator['patternIntensity'],
                           base=config.massCalculator['patternBaseline']))

        # make notes
        document.notes = 'Theoretical isotopic pattern.\n'
        document.notes += 'FWHM: %s\n\n' % (
            config.massCalculator['patternFwhm'])
        document.notes += 'Compound: %s\n' % (self.currentCompound.formula())
        document.notes += 'Monoisotopic mass: %s\n' % (mass[0])
        document.notes += 'Average mass: %s\n\n' % (mass[1])
        document.notes += 'Ion: %s\n' % (ion)
        document.notes += 'Monoisotopic m/z: %s\n' % (mz[0])
        document.notes += 'Average m/z: %s\n' % (mz[1])

        # add document
        self.parent.onDocumentNew(document=document)
 def onSave(self, evt):
     """Save current pattern as doument."""
     
     # check data
     if self.currentPatternScan == None or self.currentCompound == None:
         wx.Bell()
         return
     
     # get ion
     if self.currentIon != None:
         charge = self.currentIon[3]
         ion = self.currentIon[4]
     else:
         charge = 0
         ion = '[M]'
     
     # make document
     document = doc.document()
     document.dirty = True
     document.title = '%s %s' % (self.currentCompound.formula(), ion)
     document.spectrum = copy.deepcopy(self.currentPatternScan)
     
     # make annotations
     mass = self.currentCompound.mass()
     mz = self.currentCompound.mz(charge=charge, agentFormula=config.massCalculator['ionseriesAgent'], agentCharge=config.massCalculator['ionseriesAgentCharge'])
     document.annotations.append(doc.annotation(label='monoisotopic m/z', mz=mz[0], ai=config.massCalculator['patternIntensity'], base=config.massCalculator['patternBaseline']))
     document.annotations.append(doc.annotation(label='average m/z', mz=mz[1], ai=config.massCalculator['patternIntensity'], base=config.massCalculator['patternBaseline']))
     
     # make notes
     document.notes = 'Theoretical isotopic pattern.\n'
     document.notes += 'FWHM: %s\n\n' % (config.massCalculator['patternFwhm'])
     document.notes += 'Compound: %s\n' % (self.currentCompound.formula())
     document.notes += 'Monoisotopic mass: %s\n' % (mass[0])
     document.notes += 'Average mass: %s\n\n' % (mass[1])
     document.notes += 'Ion: %s\n' % (ion)
     document.notes += 'Monoisotopic m/z: %s\n' % (mz[0])
     document.notes += 'Average m/z: %s\n' % (mz[1])
     
     # add document
     self.parent.onDocumentNew(document=document)
Beispiel #3
0
 def onAnnotate(self, evt=None):
     """Annotate selected peak."""
     
     # check document and selected peak
     if self.currentDocument == None or self.selectedPeak == None:
         wx.Bell()
         return
     
     # make annotation
     peak = self.currentDocument.spectrum.peaklist[self.selectedPeak]
     annot = doc.annotation(label='', mz=peak.mz, ai=peak.ai, base=peak.base, charge=peak.charge)
     
     # get annotation label
     dlg = dlgNotation(self.parent, annot, button='Add')
     if dlg.ShowModal() == wx.ID_OK:
         dlg.Destroy()
     else:
         dlg.Destroy()
         return
     
     # add annotation
     self.currentDocument.annotations.append(annot)
     self.currentDocument.sortAnnotations()
     self.parent.onDocumentChanged(items=('annotations'))