Nmrglue

Nmrglue, an open source Python package for working with multidimensional NMR data, is described. When used in combination with other Python scientific libraries, nmrglue provides a highly flexible and robust environment for spectral processing, anal. And visualization and includes a no. Of common utilities such as linear prediction, peak.

Introduction:

We have recently shown that sparsely sampled NMR spectra can be reconstructed using Deep Neural Networks: D. Flemming Hansen 'Using Deep Neural Networks to Reconstruct Non-uniformly Sampled NMR Spectra' Journal of Biomolecular NMR (2019).

  • DCEST/COS-CEST experiments¶. Nmrglue.agilent; Relaxation experiments¶.
  • Se details at: relax with OpenDX. NMRPipe. MddNMR. nmrglue. Art Palmers software: ModelFree4.

This scripts provided below will allow you to reconstruct sparsely sampled 2D spectra. The scripts have been tested under

  1. Linux Ubuntu 18.04 using the python 2.7.15rc
  2. tensorflow 1.14.0 (GPU)
  3. keras 2.2.4
  4. numpy 1.16.4
  5. nmrglue 0.6

Thus, if not already installed, you will need to install the python libraries: tensorflow, keras, numpy, and nmrglue.

Keep in mind that the neural network can only reconstruct spectra that have been recorded with the sampling schedules that it has been trained on. Currently two sampling schedules are provided (Also provided in the tar file below):

  1. Poisson-Gap Sampling: 32 complex points sampled out of 256
  2. Random Sampling: 32 comple points sampled out of 256

The parameters used to train the network for the provided examples are tailored towards 15N-1H HSQC spectra. Spectra must be recorded with the first point of the FID being recorded at time=0 s, such that phases in the indirect dimension are p0 ~0 and p1 ~0.

Further instructions are provided in the README file within the tar file as well as comments within the scripts.

Download

Reading NMR files¶

Nmrglue Python

Nmrglue tutorial

nmrglue can read and write to a number of common NMR file formats. To seehow simple this can be let’s read a 2D NMRPipe file.

Here we have imported the nmrglue module and opened the NMRPipe filetest.fid. nmrglue contains a number of modules for reading and writing NMRfiles and all of these modules have a read function which opens a fileor directory containing NMR data, reads in any necessary information,and loadsthe spectral data into memory. The read function returns a 2-tuplecontaining a python dictionary with file and spectral parameters and anumpy array object containing the numericspectral data. Currently the following file formats are supported by nmrgluewith the associated module:

ModuleFile Format
brukerBruker
pipeNMRPipe
sparkySparky
varianVarian/Agilent

Examining the data object in more detail:

We can see that this is a two dimensional data set with 1500 complex pointsin the direct dimension and 332 points in the indirect dimension. nmrgluetakes care of converting the raw data in the file into an array of appropiatetype, dimensionality, and quadrature. For complex data the last axis,typically the direct dimension, is convert to a complex data type. The otheraxes are not converted.In some cases not all of the information needed to represent the spectral dataas a well formed numpy array is not stored in the file or the values determinedautomatically are incorrect. In many of these cases this information can bespecified directly in the function call.

Nmrglue Examples

For example the read function in the varian module sometimes cannotdetermine the shape or fid ordering of 3D files correctly. These parameterscan be explicitly provided in the function call with the shape and torderkeywords. See nmrglue.varian for details.