10 Practical nmrglue Scripts for Automating NMR Workflows

10 Practical nmrglue Scripts for Automating NMR Workflows

1. Batch convert Bruker/Varian → NMRPipe

  • Purpose: Convert many experiments into NMRPipe format automatically.
  • Key steps: iterate experiment directories, ng.bruker.read/ng.varian.read, ng.pipe.write, preserve/modify dic, handle overwrite.

2. Low-memory 3D processing pipeline

  • Purpose: Process large 3D NMRPipe datasets trace-by-trace.
  • Key steps: ng.pipe.read_lowmem or iter3D, apply ng.proc_base functions per slice (apodization, FT, phase), write_lowmem to output.

3. Automated phasing and baseline correction for 1D spectra

  • Purpose: Auto phase and flatten baselines for many 1D spectra.
  • Key steps: read file, ng.proc_base.ft, automatic phase search (grid search or optimize), ng.proc_bl.sol_spline or polynomial baseline removal, save processed spectra and QC plots.

4. Coadd and average repeat acquisitions

  • Purpose: Combine multiple FIDs (coadd) and generate SNR-improved spectrum.
  • Key steps: read multiple FIDs, align/shift if needed, sum or weighted average, normalize, write result and plot.

5. Peak picking and export to CSV

  • Purpose: Detect peaks in 1D/2D spectra and export positions/intensities.
  • Key steps: process to frequency domain, use simple local-max or ng.analysis peak routines, convert indices → ppm using dic, save CSV with columns (ppm1, ppm2, intensity).

6. Automated chemical shift axis generation and referencing

  • Purpose: Build ppm axes for datasets and apply referencing offsets.
  • Key steps: compute axis from dic parameters, apply user/default reference, update dic, save updated files and summary table of shifts.

7. 2D contour plotting with auto-level selection

  • Purpose: Produce publication-ready contour figures in batch.
  • Key steps: process data, compute noise/levels (e.g., multiples of RMS), use matplotlib contourf/contour, save PNG/PDF for each dataset.

8. Zero-filling, apodization, and FT optimization sweep

  • Purpose: Test combinations of zf/apodization to pick best processing parameters.
  • Key steps: loop over parameter grid, apply ng.proc_base.zf_size/ng.proc_base.apodization/ng.proc_base.fft, compute SNR metric, save best-parameter report and spectra.

9. Convert NMRPipe → Sparky/UCSF for assignment tools

  • Purpose: Convert processed NMRPipe files into Sparky format for assignment.
  • Key steps: ng.pipe.read, use ng.convert.converter or pipe2sparky examples, write ucsf files, generate metadata mapping.

10. Inversion-recovery/T1 automated fitting pipeline

  • Purpose: Read multiple relaxation delays, process spectra, fit exponential recoveries per peak.
  • Key steps: read series (e.g., Bruker), process each delay, pick peaks or integrate regions, fit I(t)=A(1−2exp(−t/T1)) or appropriate model, output T1 map/CSV and plots.

Code snippets and example scripts for each are available in the nmrglue examples and documentation (see the nmrglue GitHub and ReadTheDocs).

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *