, create MARS pseudoresidue table from Sparky assignment table

From NMR Wiki

Jump to: navigation, search


Create MARS assignment table input from sparky list of chemical shifts.


  • in sparky "assign" peaks to arbitrarily named pseudoresidues, e.g. P1, P2, etc.
  • use atom names CA CA-1 CB CB-1 CO CO-1 HN N.
  • save assignment table
  • create file with the content shown in "code" section below.
  • run: <   sparky.shifts   >  mars_shifts.inp


use strict;
my @lines = <>;
shift  @lines;
shift  @lines;
my %at;
foreach my $l (@lines) {
    chomp $l;
    my @bits = split ' ', $l;
    my $resname = $bits[0];
    my $atom = $bits[1];
    my $shift = $bits[3];
    my $count = $bits[5];
    next if $count == 0;
    $at{$resname}{$atom} = $shift;
my @atom_list = qw (CA    CA-1      CB    CB-1      CO    CO-1       HN       N);
print "\t", join("\t",@atom_list), "\n";
for my $resname (keys %at) {
    my $rec = $at{$resname};
    print $resname, "\t";
    for my $catom (@atom_list) {
        if (exists $rec->{$catom}) {
            print $rec->{$catom};
        else {
            print '-';
        print "\t";
    print "\n";
Personal tools