JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for CCPNMR Archives


CCPNMR Archives

CCPNMR Archives


CCPNMR@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

CCPNMR Home

CCPNMR Home

CCPNMR  February 2006

CCPNMR February 2006

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: Navigation Macro?

From:

igor barsukov <[log in to unmask]>

Reply-To:

CcpNmr software mailing list <[log in to unmask]>

Date:

Wed, 22 Feb 2006 09:47:25 +0000

Content-Type:

multipart/mixed

Parts/Attachments:

Parts/Attachments

text/plain (749 lines) , igorFuncs.py (138 lines)

Sorry, forgot about the second file with the functions. Attached. Just
put it into the same directory as the main macro file. If you still get
complains, add the directory to the PYTHONPATH.

Cheers
Igor

Vicky Higman wrote:

> Hi Igor,
>
> thanks for the macro. I have tried installing it, but get an error as 
> the program can't seem to find 'IgorFuncs'. Is that another set of 
> macros on which this one is based, or simply a path which I need to 
> rename?
>
> Thanks.
>
> Vicky
>
>
>
>
> On 21/02/06, *igor barsukov* <[log in to unmask] 
> <mailto:[log in to unmask]>> wrote:
>
>     Hi Linda,
>
>     I attached the macro we use for side chain assignments. You may
>     find it
>     useful and can modify it further.
>
>     In general, if this macro is of interest, it can be added to the
>     CCPN site.
>
>     Cheers
>     Igor
>
>     Linda Ball wrote:
>
>     >Hi all,
>     >
>     >What we really need here is a macro that does the equivalent job of
>     >ANSIG's
>     >incredibly useful 'seq_C' macro, which, upon receiving a sequence
>     number
>     >as
>     >input displays the desired C/H nucleus pair for that residue, e.g.
>     >Ca/Ha, Cb/Hb1,
>     >Cb/Hb2, etc, etc. I'm sure that such a central macro must already
>     exist
>     >for
>     >Analysis. If so, could anyone point us to it?
>     >While I'm on the subject, is there also a macro equivalent to ANSIGs
>     >'show_ss'
>     >(show spin system)? This simply displays only those assignment labels
>     >that are
>     >required for a user-specified residue, while all other assignment
>     labels
>     >are
>     >undisplayed, and would be much les cluttered than the current display
>     >where all
>     >labels are shown.
>     >
>     >Cheers,
>     >
>     >Linda
>     >
>     >
>     >
>     >
>     >
>     >>>> [log in to unmask]
>     <mailto:[log in to unmask]>  >>>
>     >>>>
>     >>>>
>     >Hi,
>     >
>     >I am wanting to check my 3D 13C-NOESY specifically for Ha(i)-Hb(i+3)
>     >helical
>     >NOEs. I have Ha and Hb shifts from my HBHA(CO)NH spectrum and the
>     Ca/Cb
>     >shifts  from the CBCA(CO)NH or CBCANH spectra. So in theory,
>     finding the
>     >NOEs should not be a problem. If I try to get to the correct
>     place in
>     >the
>     >13C NOESY simply by using the RightMouse Navigate tool, it takes my a
>     >while
>     >to get there.
>     >Is there any chance someone might be able to write me a macro, or
>     >perhaps
>     >has a macro (or one which could be easily changed) where I could
>     specify
>     >residue i and then would be taken to the Ha(i), Hb(i+3),Ca(i)
>     location
>     >in
>     >the 13C spctrum?
>     >Thanks.
>     >
>     >Vicky
>     >
>     >
>
>
>     --
>     Dr. Igor Barsukov
>
>     Biological NMR Centre,
>     University of Leicester
>     PO Box 138,
>     University Road,
>     Henry Wellcome Building,
>     Leicester LE1 9HN
>     UK
>     E-mail: [log in to unmask] <mailto:[log in to unmask]>
>     Tel: +44 (0)116 229 7098
>     FAX: +44 (0)116 229 7053
>
>
>
>
>     import re,os,sys
>     import Tkinter
>
>     from ccpnmr.analysis.WindowBasic import getActiveWindows
>     from ccpnmr.api import Analysis
>
>     from memops.general import Implementation
>     from memops.gui.ButtonList       import ButtonList
>
>     from ccpnmr.analysis.BrowseResonancesPopup         import
>     BrowseResonancesPopup
>     #from BrowseResonancesPopup_nmrc    import BrowseResonancesPopup
>     from igorFuncs import getResidueProtElementResFromRes,
>     getBoundProtonResonances, getProtonResFromCarbRes
>
>     from memops.gui.Button import Button
>     from memops.gui.Entry import Entry
>     from memops.gui.FloatEntry import FloatEntry
>     from memops.gui.Frame import Frame
>     from memops.gui.LabelFrame      import LabelFrame
>     from memops.gui.Label import Label
>     from memops.gui.PulldownMenu import PulldownMenu
>     from memops.gui.MessageReporter import showOkCancel, showWarning,
>     showYesNo
>     from memops.gui.ScrolledMatrix import ScrolledMatrix
>     from memops.gui.Text import Text
>     from memops.gui.Spacer import Spacer
>
>     from memops.editor.Util import createDismissHelpButtonList
>     from ccpnmr.analysis.AssignmentBasic import getResonanceResidue,
>     findResonanceSet, deassignResonance, getResonanceAtomTuple,
>     removeSpinSystemResonance, makeResonanceGuiName, assignAtomsToRes,
>     mergeResonances, addSpinSystemResonance,
>     removeSpinSystemResonance, assignResonanceResidue
>     from ccpnmr.analysis.MarkBasic import createPeakMark,
>     createNonPeakMark, createRuler, \
>       removeMarks, removeRulers, createPeakDimRuler, markCounter
>
>
>     class SlimButton(Button):
>       def __init__(self, parent,*args, **kw):
>         Button.__init__(self, parent, borderwidth=1,padx=2,pady=2,
>     *args, **kw)
>
>
>     class ResTblSc(BrowseResonancesPopup):
>
>       def __init__(self,parent,project = None,argServer=None):
>             BrowseResonancesPopup.__init__(self, parent,project =
>     parent.project)
>             self.winDic={}
>             self.WindowPositionDic={}
>             self.WindowPositionDic2D={}
>             self.argServer=argServer
>             self.project = argServer.getProject()
>             self.orthogonalDict={}
>
>
>       def body(self, guiFrame):
>
>         self.isotope = 'Any'
>         self.status  = 'Any'
>         self.waitingForAtoms = 0
>         self.waitingForSpinSystem = None
>         hilightColor = '#%02x%02x%02x' % (128, 128, 200)
>         self.titleColor   = '#%02x%02x%02x' % (0, 0, 128)
>         self.untoggledDict = { 'fg': 'black', 'relief': 'raised' ,
>     'bg': 'grey83'}
>         self.toggledDict    = { 'fg': 'white', 'relief': 'raised' ,
>     'bg': hilightColor}
>         self.isotopeNames = ['Any','1H','15N','13C','unknown']
>         self.statusNames  = ['Any','Assigned','Unassigned','Orphaned']
>         shiftListNames = self.getShiftListNames (self.project)
>         shiftLists     =
>     list(self.project.findAllNmrMeasurementLists(className = 'ShiftList'))
>         self.shiftList = None
>         self.chain     = None
>         self.ccpCode   = None
>
>         row = 0
>
>         frame=LabelFrame(guiFrame, text='Navigation')
>         frame.grid(row=row, column=0, columnspan=10, rowspan=2,
>     sticky=Tkinter.EW)
>         frame.grid_columnconfigure(1, weight=1)
>
>         self.orthogPulldown = PulldownMenu(frame, entries=['None'],
>     callback=None)
>         self.orthogPulldown.grid(row=0, column=0, sticky=Tkinter.W)
>         self.orthogPulldown1 = PulldownMenu(frame, entries=['None'],
>     callback=None)
>         self.orthogPulldown1.grid(row=0, column=1, sticky=Tkinter.W)
>         self.orthogPulldown2D = PulldownMenu(frame, entries=['None'],
>     callback=None)
>         self.orthogPulldown2D.grid(row=0, column=2, sticky=Tkinter.W)
>         self.orthogButton = SlimButton(frame,text='Goto
>     position:',command= self.gotoOrthogPlaneAll)
>         self.orthogButton.grid(row=0, column=3, sticky=Tkinter.EW)
>         self.markButton = SlimButton(frame,text='Nxt
>     strip',command=self.incrementActiveStripAll)
>         self.markButton.grid(row=0, column=4, sticky= Tkinter.EW)
>         self.markButton = SlimButton(frame,text='Prv
>     strip',command=self.decrementActiveStripAll)
>         self.markButton.grid(row=0, column=5, sticky=Tkinter.EW)
>         self.markButton = SlimButton(frame,text='0 strip',command=
>     self.zeroActiveStrip)
>         self.markButton.grid(row=0, column=6, sticky=Tkinter.EW)
>         self.markButton = SlimButton(frame,text='Mark
>     Res',command=self.markAllResShift)
>         self.markButton.grid(row=0, column=7, sticky= Tkinter.EW)
>
>         self.showAllRes = SlimButton(frame,text='Shw All
>     Rs',command=self.showAllRes)
>         self.showAllRes.grid(row=1, column=3, sticky=Tkinter.EW)
>         self.markAllRes = SlimButton(frame,text='Mrk All Rs',command=
>     self.markAllRes)
>         self.markAllRes.grid(row=1, column=4, sticky=Tkinter.EW)
>         self.markRemoveButton = SlimButton(frame,text='Del
>     Marks',command=self.removeAllMarks)
>         self.markRemoveButton.grid(row=1, column=5, sticky= Tkinter.EW)
>         row += 1
>         row += 1
>
>
>         if shiftLists:
>           self.shiftList = shiftLists[0]
>
>         guiFrame.grid_columnconfigure(9, weight=1)
>     #    row = 0
>         self.shiftValueEntry = FloatEntry(self, returnCallback=
>     self.setShiftValue, width=10)
>         self.nameEntry       = Entry(self,
>     returnCallback=self.setName, width=12)
>
>         self.shiftListLabel    = Label(guiFrame, text = 'ShiftList:')
>         self.shiftListPulldown = PulldownMenu(guiFrame,
>     self.changeShiftList, shiftListNames, selected_index=0,
>     label_color = self.titleColor, do_initial_callback=False)
>         self.isotopeLabel      = Label(guiFrame, text = ' Isotope:')
>         self.isotopePulldown   = PulldownMenu(guiFrame,
>     self.changeIsotope, self.isotopeNames, selected_index=0,
>     label_color = self.titleColor, do_initial_callback=False)
>         self.statusLabel       = Label(guiFrame, text = ' Status:')
>         self.statusPulldown    = PulldownMenu(guiFrame,
>     self.changeStatus, self.statusNames, selected_index=0, label_color
>     = self.titleColor, do_initial_callback=False)
>         self.chainLabel        = Label(guiFrame, text = ' Chain:')
>         self.chainPulldown     = PulldownMenu(guiFrame,
>     self.changeChain, selected_index=0, label_color = self.titleColor,
>     do_initial_callback=False)
>         self.ccpCodeLabel      = Label(guiFrame, text = ' CcpCode:')
>         self.ccpCodePulldown   = PulldownMenu(guiFrame,
>     self.changeCcpCode, selected_index=0, label_color =
>     self.titleColor, do_initial_callback=False)
>         #self.spacer2           = Spacer(guiFrame)
>
>         self.shiftListLabel.grid   (row=row, column=0, columnspan=1,
>     sticky=Tkinter.W)
>         self.shiftListPulldown.grid (row=row, column=1, columnspan=1,
>     sticky=Tkinter.W)
>         self.isotopeLabel.grid     (row=row, column=2, columnspan=1,
>     sticky=Tkinter.W)
>         self.isotopePulldown.grid  (row=row, column=3, columnspan=1,
>     sticky=Tkinter.W )
>         self.statusLabel.grid      (row=row, column=4, columnspan=1,
>     sticky=Tkinter.W)
>         self.statusPulldown.grid   (row=row, column=5, columnspan=1,
>     sticky=Tkinter.W)
>         self.chainLabel.grid       (row=row, column=6, columnspan=1,
>     sticky=Tkinter.W)
>         self.chainPulldown.grid    (row=row, column=7, columnspan=1,
>     sticky=Tkinter.W)
>         self.ccpCodeLabel.grid     (row=row, column=8, columnspan=1,
>     sticky=Tkinter.W )
>         self.ccpCodePulldown.grid  (row=row, column=9, columnspan=1,
>     sticky=Tkinter.W)
>
>         row += 1
>         guiFrame.grid_rowconfigure(row, weight=1)
>         #shift list experiments
>         #shift list unit
>         justifyList =
>     ['center','right','left','left','center','center','center','center','center','center']
>
>         colHeadings =
>     ['#',"Shift","SD",'Assign\nName','Residue','Isotope','Other\nName','Total\nPeaks','Shift
>     List\nPeaks','Spin\nSystem #']
>         editWidgets      =
>     [None,self.shiftValueEntry,None,None,None,None,self.nameEntry,None,None,None]
>         editGetCallbacks =
>     [None,self.getShiftValue,  None,None,None,None,self.getName  ,self.showPeaks,
>     self.showShiftListPeaks,None]
>         editSetCallbacks =
>     [None,self.setShiftValue,  None,None,None,None,self.setName  ,None,None,None]
>         self.scrolledMatrix = ScrolledMatrix(guiFrame,
>     justifyList=justifyList, initialRows=16, headingList=colHeadings,
>                                              editWidgets=editWidgets,
>                                             
>     editGetCallbacks=editGetCallbacks,
>                                             
>     editSetCallbacks=editSetCallbacks,
>                                              font=self.smallFont,
>     callback=self.selectCell, multiSelect=1)
>         self.scrolledMatrix.grid   (row=row, column=0, columnspan=10,
>     sticky = Tkinter.NSEW, padx=1)
>         self.scrolledMatrix.doEditMarkExtraRules =
>     self.doEditMarkExtraRules
>
>
>         texts    = ['Deassign','Assign','Add to\nSpin System','Remove
>     from\nSpin System','Swap\nProchirals']
>         commands =
>     [self.disconnectAtoms,self.waitForAtoms,self.addToSpinSys,self.removeFromSpinSys,self.swapProchiral]
>         buttonList = ButtonList(guiFrame, texts=texts,
>     commands=commands, expands=True)
>         buttonList.grid(row = 4, column = 0, columnspan=10, sticky =
>     Tkinter.EW)
>         self.assignButton        = buttonList.buttons[1]
>         self.assSpinSysButton    = buttonList.buttons[2]
>         self.swapProchiralButton = buttonList.buttons[4]
>
>         texts    = ['Delete','Delete\nOrphans','Merge','Show
>     Total\nPeaks','Show Shift List\nPeaks']
>         commands =
>     [self.deleteResonance,self.deleteOrphans,self.mergeResonances,self.showPeaks,
>     self.showShiftListPeaks]
>         self.bottomButtons = createDismissHelpButtonList(guiFrame,
>     texts=texts, expands=1,
>                                commands=commands, help_url=self.help_url)
>         self.bottomButtons.grid(row = 5, columnspan = 10, sticky =
>     Tkinter.EW)
>
>
>         self.registerNotify(self.updateShiftLists,
>     'ccp.Nmr.ShiftList', 'setName')
>         self.registerNotify (self.updateShiftLists,
>     'ccp.Nmr.ShiftList', '__init__')
>         self.registerNotify(self.updateShiftLists,
>     'ccp.Nmr.ShiftList', 'delete')
>
>         for func in ('__init__', 'delete'):
>           for clazz in ('ccp.Nmr.PeakDimContrib',
>     'ccp.Nmr.Shift','ccp.Nmr.ResonanceSet', 'ccp.Nmr.Resonance'):
>             self.registerNotify(self.updateAfter, clazz, func)
>
>         self.registerNotify(self.updateAfter, 'ccp.Nmr.ResonanceSet',
>     'addResonance')
>          self.registerNotify(self.updateAfter, 'ccp.Nmr.Shift',
>     'setValue')
>         self.registerNotify(self.updateAfter, 'ccp.Nmr.Shift', 'setError')
>
>         for func in ('setDetails', 'setIsotopeCode',
>     'setName','removeAssignName','setAssignNames','addAssignName'):
>           self.registerNotify(self.updateAfter, 'ccp.Nmr.Resonance', func)
>
>         for func in ('setCcpCode', 'addResonance', 'removeResonance',
>     'setResonances','addAtomSet', 'delete'):
>           self.registerNotify(self.updateAfter ,
>     'ccp.Nmr.ResonanceGroup', func)
>
>         self.registerNotify(self.updateAfter, 'ccp.Nmr.Shift',
>     'getResonance')
>
>         self.resonances=[]
>         self.resonance = None
>
>         self.refresh = 0
>         self.update ()
>
>
>       def gotoOrthogPlane(self,windowName,col=0,active='y'):
>
>         if windowName!='None':
>             if active=='y':
>                 col=self.activeStrip(windowName)
>
>             popup=self.argServer.parent.getWindowPopup (windowName)
>             if windowName in self.WindowPositionDic.keys():
>                 position=self.WindowPositionDic[windowName]
>             else:
>                 position=self.WindowPositionDic2D[windowName]
>             popup.gotoPosition (position,col=col)
>
>       def gotoOrthogPlaneAll(self):
>
>         self.gotoOrthogPlane(self.orthogPulldown.getSelected())
>         self.gotoOrthogPlane(self.orthogPulldown1.getSelected())
>         self.gotoOrthogPlane(self.orthogPulldown2D.getSelected ())
>
>       def activeStrip(self,windowName):
>
>             window=self.orthogonalDict[windowName]
>             for n in range(0,len(window.axisPanels[0].axisRegions)):
>                 if window.axisPanels[0].axisRegions[n].isActive: return n
>
>       def zeroActiveStrip(self):
>
>         windowName=self.orthogPulldown.getSelected()
>         if windowName!='None':
>             popup=self.argServer.parent.getWindowPopup (windowName)
>             popup.activateStrip(0)
>
>         windowName=self.orthogPulldown1.getSelected()
>         if windowName!='None':
>             popup=self.argServer.parent.getWindowPopup(windowName)
>             popup.activateStrip (0)
>
>         windowName=self.orthogPulldown2D.getSelected()
>         if windowName!='None':
>             popup=self.argServer.parent.getWindowPopup(windowName)
>             popup.activateStrip(0)
>
>       def incrementActiveStripAll(self):
>
>         self.incrementActiveStrip(self.orthogPulldown.getSelected())
>         self.incrementActiveStrip(self.orthogPulldown1.getSelected())
>         self.incrementActiveStrip(self.orthogPulldown2D.getSelected())
>
>       #mark all resonances from the residue identified by the selected
>     resonance
>       def markAllRes(self):
>         resonance = self.scrolledMatrix.currentObjects[0]
>         if resonance.resonanceSet:
>             for r in
>     getResidueProtElementResFromRes(resonance,elementSymbol='C'):
>                 self.markResShift (r)
>                 for r1 in
>     getProtonResFromCarbRes(r):  self.markResShift(r1)
>
>             for r in
>     getResidueProtElementResFromRes(resonance,elementSymbol='N'):
>                 self.markResShift(r)
>                 for r1 in
>     getProtonResFromCarbRes(r):  self.markResShift(r1)
>
>       #display strips for the whole residue, alphabetical order
>       def showAllRes(self):
>         self.zeroActiveStrip()
>         resonance = self.scrolledMatrix.currentObjects [0]
>         ResPairs=[]
>         CarbResDic={}
>         if resonance.resonanceSet:
>             for r in
>     getResidueProtElementResFromRes(resonance,elementSymbol='C'):
>                 (molSystem, chain, residue, name) =
>     getResonanceAtomTuple(r)
>                 CarbResDic[name]=r
>             CarbNames=CarbResDic.keys()
>             CarbNames.sort()
>             print CarbNames
>             for name in CarbNames:
>                 r=CarbResDic[name]
>                 for r1 in getProtonResFromCarbRes(r):
>                     (molSystem1, chain1, residue1, name1) =
>     getResonanceAtomTuple(r1)
>                     if name=='Cga' or name=='Cgb' or name=='Cda' or
>     name=='Cdb':
>                         if name[1:3]!=name1[1:3]: continue
>                     ResPairs.append([r,r1])
>
>             #windows may have different number of pannels, ans smaller
>     than numer of atoms
>             cntMax=0
>             windowName=self.orthogPulldown.getSelected ()
>             if windowName!='None':
>                 window=self.orthogonalDict[self.orthogPulldown.getSelected()]
>                 cntMax=len(window.axisPanels[0].axisRegions)
>             cntMax1=0
>             windowName=self.orthogPulldown1.getSelected ()
>             if windowName!='None':
>                 window=self.orthogonalDict[self.orthogPulldown1.getSelected()]
>                 cntMax1=len(window.axisPanels[0].axisRegions)
>             cntMax2D=0
>             windowName=self.orthogPulldown2D.getSelected ()
>             if windowName!='None':
>                 window=self.orthogonalDict[self.orthogPulldown2D.getSelected()]
>                 cntMax2D=len(window.axisPanels[0].axisRegions)
>
>             for ResPair in ResPairs:
>                 if cntMax>0:
>                     self.goToPosition(self.orthogPulldown.getSelected(),ResPair)
>                 if cntMax1>0:
>                     self.goToPosition(self.orthogPulldown1.getSelected(),ResPair)
>                 if cntMax2D>0:
>                     self.goToPosition(self.orthogPulldown2D.getSelected(),ResPair)
>                 self.incrementActiveStripAll()
>                 cntMax-=1
>                 cntMax1-=1
>                 cntMax2D-=1
>
>         #resonances = [r1,r2]
>       def goToPosition(self,windowName,resonances):
>         if windowName=='None': return
>         window=self.orthogonalDict[windowName]
>         resTypesDic={}
>         if len(resonances)>2: return
>         if len(resonances)==2:
>             if
>     resonances[0].isotope.massNumber==resonances[1].isotope.massNumber:
>     return
>
>         for resonance in resonances:
>             isotopeText = '%d%s' % (resonance.isotope.massNumber,
>     resonance.isotope.chemElement.symbol)
>             resTypesDic[isotopeText]=resonance
>
>         position={}
>         for axisPanel in window.axisPanels:
>             if axisPanel.label=='y ' and len(window.axisPanels)!=2:
>     continue
>             for key in resTypesDic.keys():
>                 if key == axisPanel.axisType.name
>     <http://axisPanel.axisType.name>:
>                     position[axisPanel.label
>     ]=self.getResShift(resTypesDic[key])
>
>         if len(resTypesDic.keys())!=len(position.keys()): return
>     #    print position
>
>         popup=self.argServer.parent.getWindowPopup(windowName)
>         col=self.activeStrip (windowName)
>         popup.gotoPosition(position,col=col)
>     ##~         if len(window.axisPanels)==2:
>     ##~             self.WindowPositionDic2D[window.name
>     <http://window.name>]=d_tmp
>     ##~         else:
>     ##~             self.WindowPositionDic[window.name
>     <http://window.name>]=d_tmp
>     #
>
>
>       def incrementActiveStrip(self,windowName):
>
>         if windowName!='None':
>             window=self.orthogonalDict [windowName]
>             popup=self.argServer.parent.getWindowPopup(windowName)
>             col=popup.getActiveStrip()
>             if col=='all': col=0
>             if col<len(window.axisPanels[0].axisRegions)-1: col+=1
>             popup.activateStrip(col)
>
>       def decrementActiveStrip(self,windowName):
>
>         if windowName!='None':
>             window=self.orthogonalDict[windowName]
>             popup=self.argServer.parent.getWindowPopup (windowName)
>             col=popup.getActiveStrip()
>             if col=='all': col=0
>             if col>0: col-=1
>             popup.activateStrip(col)
>
>       def decrementActiveStripAll(self):
>
>         self.decrementActiveStrip (self.orthogPulldown.getSelected())
>         self.decrementActiveStrip(self.orthogPulldown1.getSelected())
>         self.decrementActiveStrip(self.orthogPulldown2D.getSelected())
>
>       def selectCell(self, resonance, row, col):
>
>         self.resonance = resonance
>
>         self.findWindows()
>
>       def getResShift(self, resonance):
>
>         if self.shiftList:
>           shift= resonance.findFirstShift(parentList = self.shiftList)
>           return shift.value
>         else: return None
>
>       def markResShift(self, resonance):
>         positions=[self.getResShift(resonance)]
>         isotopeText = '%d%s' % (resonance.isotope.massNumber,
>     resonance.isotope.chemElement.symbol )
>         axisType =None
>         activeWindows = getActiveWindows(self.project)
>         for window in activeWindows:
>             if axisType: break
>             for axisPanel in window.axisPanels:
>                 if isotopeText == axisPanel.axisType.name
>     <http://axisPanel.axisType.name>:
>                     axisTypes=[axisPanel.axisType]
>                     break
>
>         createNonPeakMark1(positions, axisTypes)
>
>       def markAllResShift(self):
>         for resonance in self.scrolledMatrix.currentObjects:
>             self.markResShift(resonance)
>
>       def removeAllMarks(self):
>         removeMarks(self.project,removeAll=True)
>
>       def findWindows(self):
>         resTypesDic={}
>         if len(self.scrolledMatrix.currentObjects)>2: return
>         if len(self.scrolledMatrix.currentObjects)==2:
>             if
>     self.scrolledMatrix.currentObjects[0].isotope.massNumber==self.scrolledMatrix.currentObjects
>     [1].isotope.massNumber: return
>
>         for resonance in self.scrolledMatrix.currentObjects:
>             isotopeText = '%d%s' % (resonance.isotope.massNumber,
>     resonance.isotope.chemElement.symbol)
>             resTypesDic[isotopeText]=resonance
>
>         activeWindows = getActiveWindows(self.project)
>         self.WindowPositionDic={}
>         self.WindowPositionDic2D={}
>         self.orthogonalDict={}
>         for window in activeWindows:
>             self.orthogonalDict[window.name <http://window.name>]=window
>             d_tmp={}
>             for axisPanel in window.axisPanels:
>                 if axisPanel.label=='y' and len(window.axisPanels)!=2:
>     continue
>                 for key in resTypesDic.keys():
>                     if key == axisPanel.axisType.name
>     <http://axisPanel.axisType.name>:
>                         d_tmp[axisPanel.label]=self.getResShift(resTypesDic[key])
>
>             if len(resTypesDic.keys())==len(d_tmp.keys()):
>                 if len(window.axisPanels)==2:
>                     self.WindowPositionDic2D[window.name
>     <http://window.name>]=d_tmp
>                 else:
>                     self.WindowPositionDic[ window.name
>     <http://window.name>]=d_tmp
>
>         list=self.WindowPositionDic.keys()
>         list.append('None')
>         n=0
>         try:
>           n=list.index(self.orthogPulldown.getSelected())
>         except: pass
>         self.orthogPulldown.setup (list,n)
>
>         n=0
>         try:
>           n=list.index(self.orthogPulldown1.getSelected())
>         except: pass
>         self.orthogPulldown1.setup(list,n)
>
>         list=self.WindowPositionDic2D.keys()
>         list.append ('None')
>         n=0
>         try:
>           n=list.index(self.orthogPulldown2D.getSelected())
>         except: pass
>         self.orthogPulldown2D.setup(list,n)
>
>     def ResTblScGui(argServer=None):
>     #    popup = self.openPopup ('browse_resonances', ResTblSc)
>     #    popup.update() # TBD: not sure if this is really needed
>
>       RT=ResTblSc(argServer.parent,argServer=argServer)
>
>     def createNonPeakMark1(positions, axisTypes, lineWidth = 1,
>                           dashLength = 2, gapLength = 2, color = None,
>     remove=False):
>       """Descrn: Create a mark at a general (i.e. non-peak) position.
>          Inputs: List of Floats (Analysis.Mark.positions), List of
>     Analysis.AxisTypes,
>                  Int, Int, Int, Word (Analysis.Color.name
>     <http://Analysis.Color.name>)
>          Output: Analysis.Mark
>       """
>
>       global markCounter
>
>       project = axisTypes[0].project
>
>       if (not color):
>         name = project.application.getValue(project, keyword='marksColor',
>                                             defaultValue='red')
>         colorScheme = project.findFirstColorScheme(name=name)
>         if (colorScheme):
>           names = colorScheme.colorNames
>           ncolors = len(names)
>           color = project.findFirstColor(name=names[markCounter %
>     ncolors])
>           if (not color):
>             color = project.findFirstColor (name='black')
>           markCounter = markCounter + 1
>         else:
>           color = project.findFirstColor(name='black')
>
>       mark = Analysis.Mark(project, lineWidth=lineWidth,
>     dashLength=dashLength,
>                       gapLength=gapLength, color=color)
>
>       for n in range(len(positions)):
>         markDim = Analysis.MarkDim(mark, position=positions[n],
>     axisType=axisTypes[n])
>
>       mark.peak = None
>
>       if remove:
>         removeMarks(project)
>
>       return mark
>
>
>
>
>
>
>


-- 
Dr. Igor Barsukov

Biological NMR Centre,
University of Leicester
PO Box 138,
University Road,
Henry Wellcome Building,
Leicester LE1 9HN
UK
E-mail: [log in to unmask]
Tel: +44 (0)116 229 7098
FAX: +44 (0)116 229 7053





from ccp.general.Util import getOtherAtom def getBoundProtonResonances(resonance):   from ccpnmr.analysis.MoleculeBasic import findBoundResonances   resonances = findBoundResonances(resonance)   return [x for x in resonances if (x.isotopeCode == '1H')] #In attached file, this is getProtonResFromCarbRes(). Note that in case of #an ambiguous assignment, it will return all the possible proton resonances #(so if you've got an ambiguous CGa for VAL, you'll get the HG1* and HG2* #resonances back). def getResonancesForAtoms(atomList):      resonanceList = []   if atomList:        # Now look for the resonances that are linked to these atoms...     # First get the project level object to get the atomSets     ccpnProject = atomList[0].root     # Loop over all atomSets     for atomSet in ccpnProject.atomSets:       # Loop over the MolSystem level atoms in the list       for atom in atomList:         # If they belong to the atomSet, continue and get the resonances         if atom in atomSet.atoms:           for resSet in atomSet.resonanceSets:             for resonance in resSet.resonances:               # Doublecheck if resonance not yet in list               if not resonance in resonanceList:                 resonanceList.append(resonance)      return resonanceList    def getResidueProtElementResFromRes(resonance,elementSymbol='C'):   # The atoms for protonated carbons for this residue will go in here...   protCarbAtoms = []      # Check whether the resonance has a resonanceSet   if resonance and resonance.resonanceSet:                                                                                      # Get the MolSystem residue     residue = resonance.resonanceSet.atomSets[0].atoms[0].residue          # Get the reference ChemCompVar     # (this is the relevant variant of the chemical compound (amino acid in case of proteins))     chemCompVar = residue.chemCompVar          # The relevant carbon chemAtoms for this chemCompVar     carbChemAtoms = chemCompVar.findAllChemAtoms(elementSymbol = elementSymbol)          # Find the ones that have hydrogens attached and track them in a Python list     protCarbChemAtoms = []          for carbChemAtom in carbChemAtoms:       # Necessary to get the chemBond via the ChemCompVar because a 'superset' of ChemAtoms       # is defined with the relevant ones picked per ChemCompVar. This means that a carbon could       # have more than four bonds... but not if you select them via the ChemCompVar.       for chemBond in chemCompVar.chemBonds:         if carbChemAtom in chemBond.chemAtoms:           otherChemAtom = getOtherAtom(carbChemAtom,chemBond)           if otherChemAtom.elementSymbol == 'H':             protCarbChemAtoms.append(carbChemAtom)             break                # Now get the relevant atoms on the MolSystem level and track them     for protCarbChemAtom in protCarbChemAtoms:       protCarbAtom = residue.findFirstAtom(name = protCarbChemAtom.name)       protCarbAtoms.append(protCarbAtom)           # Get resonances for Molsystem level atoms (function at top)   protCarbResonances = getResonancesForAtoms(protCarbAtoms)        return protCarbResonances def getProtonResFromCarbRes(resonance):   # The atoms for the protons for this carbon resonance   protAtoms = []        # Check whether the resonance has a resonanceSet   if resonance and resonance.resonanceSet:                                                                                      # Get atoms per atomSet...     for atomSet in resonance.resonanceSet.atomSets:              carbAtom = atomSet.atoms[0]              # Get the chemCompVar       chemCompVar = atomSet.atoms[0].residue.chemCompVar              # Get the carbon chemAtom       carbChemAtom = carbAtom.chemAtom            # Find the hydrogens attached to it and track in a Python list       protChemAtoms = []            # Again necessary to select the chemBonds from the chemCompVar       for chemBond in chemCompVar.chemBonds:         if carbChemAtom in chemBond.chemAtoms:           otherChemAtom = getOtherAtom(carbChemAtom,chemBond)           if otherChemAtom.elementSymbol == 'H':             protChemAtoms.append(otherChemAtom)                  # Now get the relevant atoms on the MolSystem level and track them       for protChemAtom in protChemAtoms:         protAtom = carbAtom.residue.findFirstAtom(name = protChemAtom.name)         protAtoms.append(protAtom)        # Get resonances for Molsystem level atoms (function at top)   protResonances = getResonancesForAtoms(protAtoms)        return protResonances if __name__ == '__main__':   from memops.general.Io import loadXmlProjectFile   project = loadXmlProjectFile(file = 'methylTest.xml')       for resonance in project.resonances:     if resonance.resonanceSet:       print getResidueProtCarbResFromRes(resonance)       print getProtonResFromCarbRes(resonance)       

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

April 2024
March 2024
February 2024
January 2024
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
December 2003
November 2003
October 2003
September 2003


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager