Software
Simple HQSC +2xIPAP peak assign macro v2
Adapted from Graham Ball's ipap-ass.py file to work with the latest v2 Analysis
IpapAssignV2.py
—
Python Source,
1 kB (1207 bytes)
File contents
from ccpnmr.analysis.core.AssignmentBasic import isPeakAssigned
from ccpnmr.analysis.core.AssignmentBasic import assignResToDim
def ipap_ass_v2(argServer=None, peaks=None):
"""
Crude macro for copying assignments from an HSQC
peak (for example) to two other unassigned peaks.
If copying fails, make sure you've set the
tolerances for the spectra high enough (see
RDCcalculator Help).
TJS: Modified for v2 16/3/2012
"""
assert argServer or peaks
if peaks is None:
peaks = argServer.getCurrentPeaks()
if len(peaks) != 3:
msg = 'Invalid peak selection: require HSQC + 2IPAP = 3 peaks'
argServer.showWarning(msg)
return
dest1 = None
dest2 = None
for peak in peaks:
if isPeakAssigned(peak):
source = peak
elif dest1:
dest2 = peak
else:
dest1 = peak
destPeakDims1 = dest1.sortedPeakDims()
destPeakDims2 = dest2.sortedPeakDims()
for i, srcPeakDim in enumerate(source.sortedPeakDims()):
for contrib in srcPeakDim.peakDimContribs:
resonance = contrib.resonance
assignResToDim(destPeakDims1[i], resonance, tolerance=10.0)
assignResToDim(destPeakDims2[i], resonance, tolerance=10.0)
