Package: peakipy
Peakipy - NMR peak integration/deconvolution using pythonpeakipy documentationDescriptionSimple deconvolution of NMR peaks for extraction of intensities. Provided an NMRPipe format spectrum (2D or Pseudo 3D)
and a peak list (NMRPipe, Sparky or Analysis2), overlapped peaks are automatically/interactively clustered and groups
of overlapped peaks are fitted together using Gaussian, Lorentzian or Pseudo-Voigt (Gaussian + Lorentzian) lineshape.InstallationThe easiest way to install peakipy is with poetry...gitclonehttps://github.com/j-brady/peakipy.gitcdpeakipy;poetryinstallIf you don't have poetry please refer to thepoetry documentationfor more detailsAt this point the package should be installed and the main scripts (peakipy read,peakipy edit,peakipy fitandpeakipy check)
should have been added to your path.InputsPeak list (NMRPipe, Analysis v2.4, Sparky)NMRPipe frequency domain dataset (2D or Pseudo 3D)There are four main commands:peakipy readconverts your peak list and selects clusters of peaks.peakipy editis used to check and adjust fit parameters interactively (i.e clusters and mask radii) if initial clustering is not satisfactory.peakipy fitfits clusters of peaks.peakipy checkis used to check individual fits or groups of fits and make plots.You can use the-hor--helpflags for instructions on how to run the programs (e.g. peakipy read -h)OutputsPandas DataFrame containing fitted intensities/linewidths/centers etc.,fit_prefix,assignment,amp,amp_err,center_x,center_y,sigma_x,sigma_y,fraction,clustid,plane,x_radius,y_radius,x_radius_ppm,y_radius_ppm,lineshape,fwhm_x,fwhm_y,center_x_ppm,center_y_ppm,sigma_x_ppm,sigma_y_ppm,fwhm_x_ppm,fwhm_y_ppm,fwhm_x_hz,fwhm_y_hz0,_None_,None,291803398.52980924,5502183.185104156,158.44747896487527,9.264911100915297,1.1610674220702277,1.160506074898704,0.0,1,0,4.773,3.734,0.035,0.35,G,2.3221348441404555,2.321012149797408,9.336283145411077,129.6698850201278,0.008514304888101518,0.10878688239041588,0.017028609776203036,0.21757376478083176,13.628064792721176,17.6458843544780631,_None_,None,197443035.67109975,3671708.463467884,158.44747896487527,9.264911100915297,1.1610674220702277,1.160506074898704,0.0,1,1,4.773,3.734,0.035,0.35,G,2.3221348441404555,2.321012149797408,9.336283145411077,129.6698850201278,0.008514304888101518,0.10878688239041588,0.017028609776203036,0.21757376478083176,13.628064792721176,17.645884354478063
etc...If--plot=<path>option selected the first plane of each fit will be plotted in  with the files named according to the cluster ID (clustid) of the fit. Adding--showoption callsplt.show()on each fit so you can see what it looks like. However, usingpeakipy checkshould be preferable since plotting the fits during fitting
slows down the process a lot.To plot fits for all planes or interactively check them you can runpeakipy checkpeakipycheckfits.csvtest.ft2--dims=0,1,2--clusters=1,10,20--show--outname=plot.pdfWill plot clusters 1,10 and 20 showing each plane in an interactive matplotlib window and save the plots to a multipage pdf called plot.pdf. Callingpeakipy checkwith the--firstflag results in only the first plane of each fit being plotted.Runpeakipy check -hfor more options.You can explore the output data conveniently withpandas.In[1]:importpandasaspdIn[2]:importmatplotlib.pyplotaspltIn[3]:data=pd.read_csv("fits.csv")In[4]:groups=data.groupby("assignment")In[5]:forind,groupingroups:...:plt.errorbar(group.vclist,group.amp,yerr=group.amp_err,fmt="o",label=group.assignment.iloc[0])...:plt.legend()...:plt.show()Pseudo-Voigt modelWhere Gaussian lineshape isAnd Lorentzian isThe fit minimises the residuals of the functions in each dimensionFraction parameter is fraction of Lorentzian lineshape.The linewidth for the G lineshape isThe linewidth for PV and L lineshapes isTest dataDownload from git repo. To test the program for yourselfcdinto thetestdirectory . I wrote some tests for the code itself which should be run from the top directory like sopython test/test_core.py.Comparison with NMRPipeA sanity check... Peak intensities were fit using the nlinLS program from NMRPipe and compared with the output from peakipy for the same dataset.Homage to FuDAIf you would rather use FuDA then try runningpeakipy readwith the--fudaflag to create a FuDA parameter file
(params.fuda) and peak list (peaks.fuda).
This should hopefully save you some time on configuration.AcknowledgementsThanks to Jonathan Helmus for writing the wonderfulnmrgluepackage.
Thelmfitteam for their awesome work.bokehandmatplotlibfor beautiful plotting.scikit-image!My colleagues, Rui Huang, Alex Conicella, Enrico Rennella, Rob Harkness and Tae Hun Kim for their extremely helpful input.