Transferring Assignment

Hi, 
I am a new user of CCPN
so I am trying to transfer assignment from NMRstar file to a C13-C13 2D DARR spectrum. 
In the axis box I put (C, C1) and in the atom ID I put C , I got a message saying `axis do not match`. I am not sure actually what to put? 
when I tried other atom IDs like CA CB CD, it transferred some assignment but was only diagonal. I attached the file to see 
I would appreciate some advice ``   ``   
Thank you!

Hi,

at the moment the peak list creation when importing an NMRStar file is still very basic. It`ll work for HN and probably HNC type spectra, but will almost certainly fail for homonuclear spectra such as CC spectra. I`ll have a look and see if I can fix something up for you.

Vicky

Hi,

below is a macro which you can use to create a peaklist for a CC spectrum. It will create all non-diagonal intra-residue peaks. You may find that it has created more peaks than you want (e.g. if you tend to truncate your CC spectrum to show only the range 70-10ppm on the y-axis). In this case just delete any superfluous peaks when you are done.

So import your NmrStar chemical shifts as normal (e.g. by dragging the NmrStar file onto the sidebar), but without selecting `Simulate Peak List`. Instead run the Macro: go to the Marcro menu and select New; then copy and paste the macro below. In the macro you will need to specify the NmrChain that was created during the NmrStar Import as well as the spectrum in which you want to create the peaks (simply use the names as they appear in your sidebar - note that you can rename any of the items in the sidebar by double-clicking on them). Then click on Run to run the macro. You should be able to undo it again with Ctrl-Z.

You can save the macro for future use - see https://www.ccpn.ac.uk/forums/misc.php?a...elp&hid=58 for general instructions on running macros.

Python
  1. # Macro to create a CC peak list from a chemical shift list
  2.  
  3. from ccpn.core.lib.ContextManagers import undoBlock
  4.  
  5. # specify NmrChain associated with the imported chemical shifts
  6. nmrChain = project.getByPid(`NC:@2`)
  7.  
  8. # specify CC spectrum
  9. targetSpectrum = project.getByPid(`SP:sh3_uni_pdsd100`)
  10. # find carbon dimensions
  11. carbonAxes= [axis for axis in targetSpectrum.axisCodes if axis.startswith(`C`)]
  12.  
  13.  
  14. def makePairs(theList):
  15. "make pairs from the elements of theList (excluding same-item pairs); return a list of tuples"
  16. result = []
  17. for idx, item1 in enumerate(theList):
  18. for item2 in theList[idx+1:]:
  19. result.append( (item1, item2) )
  20. result.append( (item2, item1) )
  21. return result
  22.  
  23.  
  24. with undoBlock():
  25. # create new peaklist for specified spectrum
  26. peakList = targetSpectrum.newPeakList(isSimulated=True)
  27. print(`created:`, peakList)
  28.  
  29. # Loop through each NmrResidue in the NmrChain
  30. for nmrRes in nmrChain.nmrResidues:
  31. # Loop through each NmrAtom, selecting each carbon
  32. atomList = [nmrAtom for nmrAtom in nmrRes.nmrAtoms if nmrAtom.name.startswith(`C`)]
  33.  
  34. # create all non-diagonal combinations of C-C peaks
  35. pairs = makePairs(atomList)
  36. for atm1, atm2 in pairs:
  37. peak = peakList.newPeak(ppmPositions=(atm1.chemicalShifts[0].value, atm2.chemicalShifts[0].value))
  38. peak.assignDimension(carbonAxes[0], atm1)
  39. peak.assignDimension(carbonAxes[1], atm2)



Any issues, let me know.

Best wishes,

Vicky

Thank you so much! This is very helpful.


Hello, 

After transferring the assignments, I wanted to get data height information for each peak, but I can not get them unless I center peak them with the command `SE` . Is there a way, I can get the height without having to press the command SE. Some peaks are very close to each other and I prefer to center peak them manually. (attached photo)

Thank you!

Nesreen

Hi Nasreen,

to get the peak heights as well simply insert the line

targetSpectrum.getHeight((atm1.chemicalShifts[0].value, atm2.chemicalShifts[0].value))

at the end of the script.

In total the script will now be:

Python
  1. #Macro to create a CC peak list from a chemical shift list
  2.  
  3. from ccpn.core.lib.ContextManagers import undoBlock
  4.  
  5. # specify NmrChain associated with the imported chemical shifts
  6. nmrChain = project.getByPid(`NC:@2`)
  7.  
  8. # specify CC spectrum
  9. targetSpectrum = project.getByPid(`SP:sh3_uni_pdsd100`)
  10. # find carbon dimensions
  11. carbonAxes= [axis for axis in targetSpectrum.axisCodes if axis.startswith(`C`)]
  12.  
  13.  
  14. def makePairs(theList):
  15. "make pairs from the elements of theList (excluding same-item pairs); return a list of tuples"
  16. result = []
  17. for idx, item1 in enumerate(theList):
  18. for item2 in theList[idx+1:]:
  19. result.append( (item1, item2) )
  20. result.append( (item2, item1) )
  21. return result
  22.  
  23.  
  24. with undoBlock():
  25. # create new peaklist for specified spectrum
  26. peakList = targetSpectrum.newPeakList(isSimulated=True)
  27. print(`created:`, peakList)
  28.  
  29. # Loop through each NmrResidue in the NmrChain
  30. for nmrRes in nmrChain.nmrResidues:
  31. # Loop through each NmrAtom, selecting each carbon
  32. atomList = [nmrAtom for nmrAtom in nmrRes.nmrAtoms if nmrAtom.name.startswith(`C`)]
  33.  
  34. # create all combinations of C-C peaks
  35. pairs = makePairs(atomList)
  36. for atm1, atm2 in pairs:
  37. peak = peakList.newPeak(ppmPositions=(atm1.chemicalShifts[0].value, atm2.chemicalShifts[0].value))
  38. peak.assignDimension(carbonAxes[0], atm1)
  39. peak.assignDimension(carbonAxes[1], atm2)
  40. peak.height = targetSpectrum.getHeight((atm1.chemicalShifts[0].value, atm2.chemicalShifts[0].value))




Vicky

Thanks for the suggestion Vicky. In general, is there a way of evaluating peak heights without moving peaks when copying a peak list from one spectrum to another?

Thanks,

Nicola

Hi Nicola,
If you want use the GUI, assuming you have assigned peaks, the quickest way is to use the ChemicalshiftMapping module. Select your nmrChain, on the preferences (top left corner gearbox) select calculation mode: height, display raw; select the spectra you need then click update all.
On the binding curve graph, right click, select Export All. This will allow to extract all heights for each nmrResidue/spectra in different formats.
Let us know if you don`t want use the GUI or don`t have the peaks assigned.

Hi Luca,

Thank you for pointing out a solution. I do have peak assigned but it would be nice to have non-GUI solution. The typical scenario is the one of relaxation data: for example, if I have a series of 10 spectra in a SpectrumGroup, and a (partially) assigned peak list associated with one spectrum, it would be great to be able to copy that list to all spectra in the SpectrumGroup and gets peak heights without moving the peaks. What I am doing right now is to manually copy the peak list and refit all the peaks, but this is suboptimal when S/N is low for long relaxation delays. Any ideas?

Nicola

Ok, yes. I can add the public routines to update the peak heights without the refit and a way to extract all heights in the series as a Pandas DataFrame. If peaks are at the same positions, then the position will be the index and columns will be the series values or spectrum names... No need of assignments. will this be helpful for you?

Thank for your reply Luca, it would be perfect!

Hi Nicola,

If you are on 3.0.2, fetch the updates from the Help menu.

You will be able to select peaks, right click on any selected peak and click `recalculate Height(s).

you can all also select all by cmd (ctrl) + a
then shortcut `rh`

to get the heights in a DataFrame you can do:

Python
  1. from ccpn.core.lib.peakUtils import getSpectraHeights
  2. sg = project.spectrumGroups[0] #your spectrumGroup
  3. df = getSpectraHeights(sg.spectra)



This function is not fully tested yet, so let me know any issues.

Hi Luca,

Many thanks - I have v3.0.1 (on Win10), I`ll give it a try asap on Linux and let you know if I have issues.

Cheers,

Nicola

Dear Luca,
I saw this thread and am interested in extracting peak heights from a series of relaxation spectra. You mentioned that you can add the public routines to updated the peak heights. Is this now the case in v3.0.3?
What is now the way to extract peak heights from a series of e.g. relaxation spectra?

thanks
paul

Hi Paul,

I posted a macro called `Extract Peak heights from a series` have a look. It should do what you need.