>> "Add to spin system":
>> also applied to a selection of peaks rather than to a single one.
>
> I assume you mean to add each peak to a different spin system? - As "Add
> to spin system" already works with multiple peaks, but applies them to the
> same spin system.
No, I meant the bit that works already - oups.
The macro is nice :D , needed to change one line (line 40)
now stands as :
from ccpnmr.analysis.AssignmentBasic import assignResonanceType
def setAtomTypesToPeaks(argServer, atomType=None):
"""Descrn: Assigns atom type to all selected peaks
Inputs: ArgumentServer, Word (Nmr.Resonance.assignName)
Output: None
"""
isotopeDict = {'C':'13C','H':'1H','N':'15N'}
peaks = argServer.getCurrentPeaks()
if not atomType:
atomType = argServer.askString('Atom Type:','CA')
if not atomType:
argServer.showWarning('No atom type specified')
return
atomType = atomType.upper()
isotope = isotopeDict.get(atomType[0])
if not isotope:
argServer.showWarning('No isotope found for %s atom type' % atomType)
return
project = argServer.getProject()
atomSet = project.findFirstAtomSet(name=atomType)
# We need an atomSet for assignResonanceType
if not atomSet:
argServer.showWarning('No atom sets in project of type %s' %
atomType)
return
for peak in peaks:
for peakDim in peak.peakDims:
if peakDim.peakDimContribs:
if isotope in peakDim.dataDimRef.expDimRef.isotopeCodes:
for contrib in peakDim.peakDimContribs:
assignResonanceType(contrib.resonance, [atomSet,])
def setCalphaToPeaks(argServer):
setAtomTypesToPeaks(argServer, atomType='CA')
def setCbetaToPeaks(argServer):
setAtomTypesToPeaks(argServer, atomType='CB')
--
Dr. Krystyna Bromek
=== Biomolecular NMR ====
University of Glasgow, IBLS
Joseph Black Building B4-17,
Glasgow G12 8QQ, UK
Tel: 0141 330 6551/6459
|