Spectrum matrix file conversion

The programs listed here convert NMR frequency-domain spectrum matrices from several different formats to the format used by ANSIG. A parameter file is also produced, but it normally contains only the the matrix and submatrix sizes; all other parameters are usually commented out, and must be filled in or modified by hand using an editor such as 'vi', 'jot' or 'emacs'.

All the conversion programs produce a brief help text if one attempts to run the program without any arguments.

The matrix format used by the ANSIG program is that of the Azara NMR spectrum processing package, written by Wayne Boucher.


  • ansig2serial
  • serial2ansig
  • nothing2ansig
  • vector2ansig
  • plane2ansig
  • Serial file
  • The note "Not completely tested" means that the program has been tested with some data sets, and that it ought to work generally, however, not all possible cases have been tested.


    felix2ansig

    Usage: felix2ansig felix.mat ansigname

    This program converts both normal and squeezed FELIX files to ANSIG (un-deflated) format. In contrast to the other conversion programs, it reads the referencing data (spectral width, machine frequency, point and ppm values for each dimension), and writes it into the ANSIG parameter file.

    Two files are produced: the spectrum matrix parameter file, which will be called ansigname.par, and the spectrum matrix file, ansigname.spc.

    The program cannot handle FELIX matrices that have been split up into more than one file. Only files with a dimensionality of at most 4D can be handled.

    Not completely tested.


    nmrpipe2ansig

    Usage: nmrpipe2ansig [-f] nametemplate ansigname

    The name template uses the same notation as nmrPipe. The number of variable dimensions in the template must match the contents of the files. The referencing data in the nmrPipe files is interpreted. This program works for 2D and 3D nmrPipe files, and should work for 4D files.

    Two files are produced: the spectrum matrix parameter file, which will be called ansigname.par, and the spectrum matrix file, ansigname.spc.

    If the option -f is specified, then existing output files, if any, will be overwritten.

    Not properly tested with transposed spectra, or with 4D spectra.


    uxnmr2d2ansig

    Usage: uxnmr2d2ansig 2rr.swapped sif1 xdimf1 sif2 xdimf2 ansigname

    This program converts a UXNMR 2D file into a ANSIG format. It requires an input file that has already been properly byte-swapped. Use the 'dpp' command in UXNMR to obtain the SIF and XDIM parameter values.

    Two files are produced: the spectrum matrix parameter file, which will be called ansigname.par, and the spectrum matrix file, ansigname.spc.

    Not tested at all; this is a rewrite of an older program which worked on files from the X32 workstation in 1993, which may have been invalidated by new versions of UXNMR.


    vnmr2d2ansig

    Usage: vnmr2d2ansig phasefile ansigname [offset]

    This program converts a so-called phasefile made by VNMR to ANSIG format. The phasefile must have been created after using the VNMR 'full' command, and assumes that no transpose of the spectrum has been made. This program does not read any referencing data from the VNMR file.

    The default value for the offset parameter is 7, which is appropriate for planes out of a 3D spectrum. If the spectrum is a genuine 2D spectrum then use the value 14.

    Two files are produced: the spectrum matrix parameter file, which will be called ansigname.par, and the spectrum matrix file, ansigname.spc.

    The program seems to work well, except that the phasefile sometimes does not contain the full data (VNMR 'full' hasn't been used), in which case garbage is produced. Watch out for the offset parameter!


    vnmr3d2ansig

    This program does not exist yet.

    How to do it with the existing software: Write out the 3D VNMR file as 2D planes into separate phasefiles (see the VNMR macro below), convert the phasefiles into 2D ANSIG files (using vnmr2d2ansig), then create a 3D ANSIG file of appropriate size (using nothing2ansig), then insert the 2D ANSIG files into the (initially empty) 3D ANSIG file (using plane2ansig).

    There is a VNMR macro (due to Herbert Baumann) which can be used to output a 3D VNMR matrix as 2D VNMR phasefiles.


    ansig2serial

    Usage: ansig2serial parfile serialfile

    This program converts an ANSIG file into a serial file. The matrix file name is taken from the parameter file given as argument to the program.

    Not completely tested.


    serial2ansig

    Usage: serial2ansig serialfile nf1 nf2 [nf3 [nf4] ] ansigname

    This program converts a serial file into an ANSIG file with proper submatrix organization. The number of given nf arguments determines the dimensionality of the ANSIG file, and the sizes in the different dimensions. The product of the nf argument values must match the size of the input file.

    The parameter file produced by this program contains only size and dimensionality data.

    Not completely tested.


    nothing2ansig

    Usage: nothing2ansig nf1 nf2 [nf3 [nf4] ] ansigname

    This program creates an ANSIG matrix file from scratch, and fills it with 0.0 values. The dimensionality is determined by the number of nf arguments given, which also determine the size of the matrix in the respective dimensions.

    Two files are produced: the spectrum matrix parameter file, which will be called ansigname.par, and the spectrum matrix file, ansigname.spc.

    The program seems to work well.


    vector2ansig

    Usage: vector2ansig parfile pf1 pf2 [pf3 [pf4] ] fdim len [vecfile]

    This program writes a 1D vector of values into an ANSIG file. The values already in the ANSIG file are overwitten.

    Required arguments are the coordinates in the ANSIG file for starting point (point numbers), the variable dimension (the variable along which the vector runs) and the length of vector. The vector must fit into the matrix, given the starting point and the length. It does not have to span the entire length of the matrix.

    The vector values may be given as formatted values via standard input, if no file name is given as argument. If a file name is given, then this must be a direct-access binary format file containing the vector values.

    Not completely tested.


    plane2ansig

    Usage: plane2ansig 3d4d-parfile fd1 fd2 pos3 [pos4] 2d-parfile

    Insert a 2D plane in ANSIG matrix format into a 3D/4D ANSIG matrix file. The values already in the 3D/4D matrix in the given plane are overwritten.

    The 2D file plane must be of the same size as the plane to write it into (given by fd1 and fd2) in the 3D/4D matrix. The position in the constant dimension(s) is given by pos3 (and pos4 if 4D matrix).

    Not completely tested.


    Serial file

    A serial file is a matrix file which has all data organized in a straight-forward, non-submatrix fashion, as if the entire matrix had been read into an array and then written out directly. The serial file contains just pure data, without any information on dimensionality or referencing.

    Its sole purpose is to act as a file format for interchange with other programs.

    ANSIG cannot read a serial file. It must first be converted into a proper ANSIG file with the serial2ansig program.


    Per Kraulis 16 Apr 1996.