Revision history [back]
click to hide/show revision 1
initial version

posted Dec 08 '11 at 14:26

Andrew%20Fowler's gravatar image

Andrew Fowler
96

Here's a procedure I came up with to get a 2D spectrum in NMRPipe format from an NMRStar chemical shift file downloaded from BMRB. It's a bit tedious, but it does work. Except for the Perl script I'll put at the end, everything is in a stock NMRPipe install. Here are my instructions to myself: 1. Prepare a shift list in NMRPipe table format. You can use my star2pipe.pl script for this, modified as necessary. The list MUST contain these columns: INDEX ASS X_PPM Y_PPM X_AXIS Y_AXIS XW_HZ YW_HZ XW YW HEIGHT X_AXIS, Y_AXIS, XW, and YW can all be set to 0.0 for now. XW_HZ and YW_HZ should be reasonable values (20 Hz works well). Call this file temp.tab. 2. Prepare an empty NMRPipe spectrum. Make sure the spectral frequencies and sweep widths are reasonable. Also, the axes should be in the same order as in the peak table. Call this file temp.ft2. Two ways to do this: 2a. Make a copy of an existing HSQC with the data zeroed. nmrPipe -in myhsqc.ft2 -out temp.ft2 -fn SET -r 0.0 -ov -verb 2b. Create an empty fid and transform it: simTimeND -xN 2048 -yN 512 \ -xT 1024 -yT 256 -xMode Complex -yMode Complex \ -xSW 6000.0 -ySW 2000.0 -xOBS 500.0 -yOBS 50.0 \ -xCAR 4.773 -yCAR 118.0 -xLAB 1H -yLAB 15N \ -ndim 2 -aq2D States -out temp.fid -verb -ov nmrPipe -in temp.fid \ | nmrPipe -fn FT -di \ | nmrPipe -fn TP \ | nmrPipe -fn FT -di \ | nmrPipe -fn TP -out temp.ft2 -ov 3. Update your table file to have the correct values IN POINTS for the peak positions and linewidths: updateTab.tcl -in temp.tab -data temp.ft2 -pts -out temp_updated.tab 4. Create the synthetic spectrum using the files you've made using one of these methods: 4a. Frequency domain spectrum: simSpecND -in temp_updated.tab -data temp.ft2 -mod GAUSS1D GAUSS1D -verb 4b. Time domain (FID) data: simTimeND -in temp_updated.tab -xN 1024 -yN 256 \ -xT 512 -yT 128 -xMode Complex -yMode Complex \ -xSW 6000.0 -ySW 2000.0 -xOBS 500.0 -yOBS 50.0 \ -xCAR 4.773 -yCAR 118.0 -xLAB 1H -yLAB 15N \ -ndim 2 -aq2D States -out temp.fid -verb -ov Note that in 4b. the point sizes in both dimensions are HALVED relative to the command in step 2b. If not, the peaks are in the wrong places! This probably has to do with processing the data to get the right point sizes and deleting imaginaries. And here is my star2pipe.pl script. You'll need to modify the output in the last few lines to have all the columns/fields listed in step 1 above. #!/usr/bin/perl # script to make an NMRPipe format 15N HSQC table file with four columns # from an NMRSTAR file. The input file should only have the lines with # chemical shift assignments. # added residue offset for renumbering output file - NMRStar appears to # always start numbering at 1. # updated column numbers for NMRStar3 files with "real" and sequential # residue numbering # updated to check for same residue number as well as both H and N # usage: star2pipe.pl {NMRSTAR file} {residue offset}> {NMRPipe file} open(IN, $ARGV[0]) || die; $offset = $ARGV[1]; $index = 0; $n = 0; $h = 0; while () { chop; @x = split(' ',$_); $res = lc($x[3]); $res = ucfirst($res); if ($x[4] eq "N") { $Nppm[$index] = $x[6]; $resnumn = $x[1]; $n++; } if (($x[4] eq "H") || ($x[4] eq "HN") || ($x[4] eq "H1")) { $Hppm[$index] = $x[6]; $resnumh = $x[1]; $ass[$index] = ($x[1]+$offset).$res; $h++; } if ($h && $n && ($resnumh == $resnumn)) { $index++; $h = 0; $n = 0; } } close IN; print "VARS INDEX ASS X_PPM Y_PPM\n"; print "FORMAT %4d %s %4.2f %4.2f\n\n"; for ($i = 0; $i < $index; $i++) { printf "%4d\t%s\t%4.2f\t%4.2f\n", $i+1, $ass[$i], $Nppm[$i], $Hppm[$i]; }
click to hide/show revision 2
improved formatting

posted Dec 08 '11 at 14:32

Andrew%20Fowler's gravatar image

Andrew Fowler
96

Here's a procedure I came up with to get a 2D spectrum in NMRPipe format from an NMRStar chemical shift file downloaded from BMRB. It's a bit tedious, but it does work. Except for the Perl script I'll put at the end, everything is in a stock NMRPipe install.

Here are my instructions to myself:

  1. 1) Prepare a shift list in NMRPipe table format. You can use my star2pipe.pl script for this, modified as necessary. The list MUST contain these columns:

    INDEX ASS XPPM YPPM XAXIS YAXIS XWHZ YWHZ X_PPM Y_PPM X_AXIS Y_AXIS XW_HZ YW_HZ XW YW HEIGHT

HEIGHT

Values for XAXIS, YAXIS, XW, and YW can all be set to 0.0 for now. XWHZ and YWHZ should should be reasonable values (20 (I've found that 20 Hz works well). Call this file temp.tab.

  1. 2) Prepare an empty NMRPipe spectrum. Make sure the spectral frequencies and sweep widths are reasonable. Also, the axes should be in the same order as in the peak table. Call this file temp.ft2. Two ways to do this:

2a. Make a copy of an existing HSQC with the data zeroed.

nmrPipe -in myhsqc.ft2 -out temp.ft2 -fn SET -r 0.0 -ov -verb

2b. Create an empty fid and transform it:

simTimeND -xN 2048 -yN 512 \
-xT 1024 -yT 256 -xMode Complex -yMode Complex \
-xSW 6000.0 -ySW 2000.0 -xOBS 500.0 -yOBS 50.0 \
-xCAR 4.773 -yCAR 118.0 -xLAB 1H -yLAB 15N \
-ndim 2 -aq2D States -out temp.fid -verb -ov

nmrPipe -in temp.fid \
| nmrPipe -fn FT -di \
| nmrPipe -fn TP \
| nmrPipe -fn FT -di \
| nmrPipe -fn TP -out temp.ft2 -ov
  1. 3) Update your table file to have the correct values IN POINTS for the peak positions and linewidths:

    updateTab.tcl -in temp.tab -data temp.ft2 -pts -out temp_updated.tab

  2. temp_updated.tab

    4) Create the synthetic spectrum using the files you've made using one of these methods:

4a. Frequency domain spectrum:

simSpecND -in temp_updated.tab -data temp.ft2 -mod GAUSS1D GAUSS1D -verb

4b. Time domain (FID) data:

simTimeND -in temp_updated.tab -xN 1024 -yN 256 \
-xT 512 -yT 128 -xMode Complex -yMode Complex \
-xSW 6000.0 -ySW 2000.0 -xOBS 500.0 -yOBS 50.0 \
-xCAR 4.773 -yCAR 118.0 -xLAB 1H -yLAB 15N \
-ndim 2 -aq2D States -out temp.fid -verb -ov

Note that in 4b. the point sizes in both dimensions are HALVED relative to the command in step 2b. If not, the peaks are in the wrong places! This probably has to do with processing the data to get the right point sizes and deleting imaginaries.

And here is my star2pipe.pl script. You'll need to modify the output in the last few lines to have all the columns/fields listed in step 1 above.

#!/usr/bin/perl

# script to make an NMRPipe format 15N HSQC table file with four columns
# from an NMRSTAR file. The input file should only have the lines with
# chemical shift assignments.

# added residue offset for renumbering output file - NMRStar appears to
# always start numbering at 1.
# updated column numbers for NMRStar3 files with "real" and sequential
# residue numbering
# updated to check for same residue number as well as both H and N

# usage: star2pipe.pl {NMRSTAR file} {residue offset}> {NMRPipe file}

open(IN, $ARGV[0]) || die;
$offset = $ARGV[1];

$index = 0;
$n = 0; $h = 0;

while (<IN>) {
        chop;
        @x = split(' ',$_);
        $res = lc($x[3]);
        $res = ucfirst($res);
        if ($x[4] eq "N") {
                $Nppm[$index] = $x[6];
                $resnumn = $x[1];
                $n++;   
        }
        if (($x[4] eq "H") || ($x[4] eq "HN") || ($x[4] eq "H1")) {
                $Hppm[$index] = $x[6];
                $resnumh = $x[1];
                $ass[$index] = ($x[1]+$offset).$res;
                $h++;
        }
        if ($h && $n && ($resnumh == $resnumn)) {
                $index++;
                $h = 0; $n = 0;
        }
}

close IN;

print "VARS INDEX ASS X_PPM Y_PPM\n";
print "FORMAT %4d %s %4.2f %4.2f\n\n";

for ($i = 0; $i < $index; $i++) {
        printf "%4d\t%s\t%4.2f\t%4.2f\n", $i+1, $ass[$i], $Nppm[$i], $Hppm[$i];
}

powered by CNPROG