Deviation from average chemical shift value

Hi,

Is it possible somehow to get a colum in Peak Table that shows the deviation of the picked peak position (essentially Delta from the Peak Assigner)? It would be really useful (to me) to iteratively get rid of missassigned peaks in complex spectra. If I can sort the peak list according to the Delta then I can identify peaks where I should pay more attention, cross check with other spectra etc.
If getting such column is complicated is there a way in console to get a specific peak list sorted according to the Delta?

Thanks,
Józef

Hi Józef,

a couple of things you can do here.
One is that you can use the Assignment Inspector (AI, in Assign menu) to find any Chemical Shifts that have an unusually large error (sort the top table by Value Error). The Peak list in the lower table will show give you the relevant peaks, but you would have to go through these by hand to see which is the culprit.

Secondly, you can use a macro to add the Delta value to the comment field of your peak list. But note that if you have multiple dimensions per peak, you need to consider these separately.
The following macro will take a peak list (you’ll need to substitute the one I have used here with the one you are interested in) and add the Delta value to the comment column of the peak list, for the dimension specified in the second line (note the use of 0 for the first dimension). Note that this macro only uses one (the first) assignment per peak and the first chemical shift list in your project (increment chemcialShifts[0] to a higher value for a different ChemShiftList).

pl = get('PL:sh3_uni_pdsd100.1')   # change to your peak list of choice
dim = 0    # change to 1,2 etc. for other dimensions
for pk in pl.peaks:
    pos = pk.position[dim]
    cs = pk.assignmentsByDimensions[dim][0].chemicalShifts[0].value  # Note that 
    # this lines only uses one (the first) assignment per peak and the first chemical
    # shift list in your project.
    delta = round(abs(pos-cs), 3)
    pk.comment = str(delta)

Obviously with a bit of python you can add an extra loop and put the delta values for all dims in the comment. Or you can also misuse the Annotation column if you have two dimensions and put one in the comment and one in the annotation:

pl = get('PL:sh3_uni_pdsd100.1')  # change to your peak list of choice
for dim in range(0, pl.spectrum.dimensionCount): 
    for pk in pl.peaks:
        pos = pk.position[dim]
        cs = pk.assignmentsByDimensions[dim][0].chemicalShifts[0].value  # Note that
        # this lines assumes you have only one assignment per peak and one chemical
        # shift list.
        delta = round(abs(pos-cs), 3)
        if dim == 0:
            pk.comment = str(delta)
        else:
            # two options here, depending whether you want the second dim (and higher)
            # dims added to the comment, or the final dim in the annotation
            pk.comment += ', '
            pk.comment += str(delta)
            # pk.annotation = str(delta)

Finally, you can of course also use one of the macros in combination with the Assignment Inspector, as the lower panel gives you the peak list which will now contain your delta values. Double-clicking on a peak will as per usual take you to the peak in the spectrum.

Information on running macros can be found at Running Macros.

Vicky

Awesome. Thank you, Vicky. I have been using the AI in the way you suggested already (very useful) but wanted to concentrate on specific peak list (I have like 50 different spectra so then dealing with that in AI is a bit cumbersome at times) - your macros are useful to get me started.
Józef

1 Like