#!/usr/bin/perl #Perl script to take CSI info (exported from Felix) and the results of getratio #and make a plain text tabular file, for import into a word processing or #spreadsheet program #Melanie Nelson #4/20/99 #command line: maketable CSI_file getratio_file if ($#ARGV != 1){ $prg_name = $0; $prg_name = `basename $prg_name`; chomp ($prg_name); die<){ chomp; next unless /^\:/; @csi_line = split; ($resname, $resnum) = split(/_/,$csi_line[0]); if ($csi_line[1] =~ /Helix/){ $csi_value{$resnum} = "helix"; } elsif ($csi_line[1] =~ /Sheet/){ $csi_value{$resnum} = "sheet"; } else { $csi_value{$resnum} = "none" } $resname =~ s/\://; $resname{$resnum} = $resname; } close (CSIFILE); #now read in J-coupling data open (JFILE, $ARGV[1]) || die "Could not open J-coupling file $ARGV[1]\n"; #when the second line of dashes is encoutner, $start == 2, so start reading in #data $start = 0; while (){ if ($_ =~ /---------/) { $start++ } if ($start == 2){ @jline = split; $jcoup{$jline[1]}{$jline[2]} = $jline[3]; if ($jline[2] =~ /HA1/){ $twoflag{$jline[1]} = 1; } } } close (JFILE); #now print out the info, in correct numerical order of residues #first, sort the keys of the csi_value hash, to get correct order sub numerically { $a <=> $b } @reslist = sort numerically (keys %csi_value); #now print out header print "resnum residue CSI J-coupling\n"; foreach $r (@reslist){ if ($twoflag{$r} == 1){ printf("%4d %3s %5s %5.3f; %5.3f\n", $r,$resname{$r},$csi_value{$r},$jcoup{$r}{"HA1:HN"},$jcoup{$r}{"HA2:HN"}); } else { printf("%4d %3s %5s %5.3f\n",$r,$resname{$r},$csi_value{$r},$jcoup{$r}{"HA:HN"}); } }