Match 15N-Noesy peaks

What does the Macro do?

This macro will search for matching peak in a 3D 15N-Noesy spectrum and display possible matches as strips in the same 3D SpectrumDisplay. By default, only strips with a symmetric correlation peaks are shown.

How to run the Macro

Select a diagonal peak in your 3D 15N-Noesy for which you want to find matches. Then run the macro either from the iPython Console or the Macro Editor (or you could link it to a keyboard shortcut).
Note that you can change the search tolerance at the top of the macro.
You can also select whether or not check for (and only display) strips which include a symmetric correlation peak.

Code

# Macro to search for matching peaks in a 3D 15N-NOESY spectrum and display possible matches as strips in the same
# 3D SpectrumDisplay.
# Set your search tolerance at the top of the macro.
# By default, only strips with a symmetric correlation peaks are shown. Switch this function off by setting
# checkForSymPks = False
# at the top of the macro.
# Run by selecting a diagonal search peak in your 3D 15N-NOESY and then running the macro
# Vicky Higman
#####################################################################################################################
from ccpn.ui.gui.widgets.MessageDialog import showWarning
Htol = 0.015 # in ppm
Ntol = 0.1 # in ppm, only used when checking for the presence of symmetric correlation peaks
checkForSymPks = True
pl = current.peak.peakList
HnDim, NOEDim, NhDim = current.peak.peakList.spectrum.getByAxisCodes('dimensions', current.strip.spectrumDisplay.axisOrder)
qpk = current.peak
spDis = current.strip.spectrumDisplay
def createStrips(peaks):
    spDis.makeStripPlot(peaks=tuple(peaks), nmrResidues=None, autoClearMarks=True,
                        sequentialStrips=False, markPositions=False, widths=None)

if not current.peak:
    showWarning('No Peaks selected', 'Please make sure you have selected a peak')
else:
    matchPeaks = []
    for pk in pl.peaks:
        if pk != qpk:
            if (pk.position[NOEDim-1] <= qpk.position[NOEDim-1]+Htol) and (
                    pk.position[NOEDim-1] >= qpk.position[NOEDim-1]-Htol):
                    matchPeaks.append(pk)
    if not checkForSymPks:
        matchPeaks.insert(0,qpk)
        createStrips(matchPeaks)
    else:
        stripPeaks = [qpk, ]
        for pk in pl.peaks:
            if pk != qpk:
                if (pk.position[HnDim - 1] <= qpk.position[HnDim - 1] + Htol) and (
                        pk.position[HnDim - 1] >= qpk.position[HnDim - 1] - Htol):
                    if (pk.position[NhDim - 1] <= qpk.position[NhDim - 1] + Ntol) and (
                            pk.position[NhDim - 1] >= qpk.position[NhDim - 1] - Ntol):
                        for mpk in matchPeaks:
                            if pk != mpk:
                                if (pk.position[NOEDim - 1] <= mpk.position[HnDim - 1] + Htol) and (
                                        pk.position[NOEDim - 1] >= mpk.position[HnDim - 1] - Htol):
                                    stripPeaks.append(mpk)
        createStrips(stripPeaks)

Credits and References

Vicky Higman, CCPN Team, University of Leicester