This function reads 1D-4D spectra stored in the NMRPipe format.
read_nmrpipe(inFormat, dim_order = NULL, complex_data = FALSE)character with file name or format for multiple files
integer vector used to reorder dimensions or character specifying
logical value indicating whether complex data should be read
a named list with four elements:
multidimensional array with spectrum intensities (ppm values are given in the dimnames)
list of numeric vectors giving the ppm values associated with each int array dimension
matrix with dimension-specific header information
numeric vector with the complete header contents
The fheader row definitions are as follows (taken from NMRPipe fdatp.h):
| Row Name | Description |
| SIZE | Number of points in dimension |
| APOD | Current valid time-domain size |
| SW | Sweep Width, Hz |
| ORIG | Axis Origin (Last Point), Hz |
| OBS | Obs Freq, MHz |
| FTFLAG | 1=Freq Domain 0=Time Domain |
| QUADFLAG | Data Type Code (See Below) |
| UNITS | Axis Units Code (See Below) |
| P0 | Zero Order Phase, Degrees |
| P1 | First Order Phase, Degrees |
| CAR | Carrier Position, PPM |
| CENTER | Point Location of Zero Freq |
| AQSIGN | Sign adjustment needed for FT |
| APODCODE | Window function used |
| APODQ1 | Window parameter 1 |
| APODQ2 | Window parameter 2 |
| APODQ3 | Window parameter 3 |
| C1 | Add 1.0 to get First Point Scale |
| ZF | Negative of Zero Fill Size |
| X1 | Extract region origin, if any, pts |
| XN | Extract region endpoint, if any, pts |
| OFFPPM | Additional PPM offset (for alignment) |
| FTSIZE | Size of data when FT performed |
| TDSIZE | Original valid time-domain size |
| LB | Extra Exponential Broadening, Hz |
| GB | Extra Gaussian Broadening, Hz |
| GOFF | Offset for Gaussian Broadening, 0 to 1 |
| OBSMID | Original Obs Freq before 0.0ppm adjust |
In addition several rows contain information inferred from the header data:
| Row Name | Description |
| aq_s | Acquisition time, seconds |
| sw_ppm | Original Sweep Width, PPM |
| direct | Direct (1) or indirect (0) dimension |
| alias | Aliasing (0/1) with inversion (-1) |
For three and four dimensional datasets, the spectral data is often spread across multiple files. To read those, inFormat should be a sprintf-style string that describes how the files are named. For instance, if the files are named 001.ft3, 002.ft3, etc., then inFormat should be "%03i.ft3". If there is no zero-padding, as in this case, 0 should be omitted from the format. If there are fewer digits, then the first 3 should be changed accordingly.
The default 2D NMRPipe scripts only have a single transpose ("TP") command, leaving the the indirect dimension as the first dimension in the resulting array. The 2D plotting functions in fitnmr usually plot this first dimension along the x-axis, which will make for generally non-standard contour plots. Furthermore, when peak fitting is employed, this will also be the first dimension. To fix this, you can change the spectral order with the dim_order parameter. The order of the dimensions should be specified in the same way that would be done for aperm. Alternatively, you can specify a character argument to have fitnmr attempt to automatically detect and correct the array order. The only currently supported type is "hx", which will put the dimension with the greatest observe frequency first.
This function is partly based on the pipe2rnmr function from rNMR.