#!/usr/bin/perl #perl script to convert assignments from a four column (genxpk) format #to the format for importing spin systems into Felix97 #genxpk format: #1 LYS HA 4.538 #1 LYS HB+ 1.832 #1 LYS HB- 1.68 #1 LYS HD+ 1.70 #the input file must have all assignments for a given residue in a #contiguous group! #in atomnames, "+" is substituted for "1" and "-" is substituted for 2 #command line: make_pat .assignments [>output] #Melanie Nelson #2/23/99 if ($#ARGV != 0) { $prg_name = $0; $prg_name = `basename $prg_name`; chomp ($prg_name); die<outputfile] EODIE } open (ASSIGFILE, $ARGV[0]) || die ("Could not open the assignments file, $ARGV[0]"); #initialize residue number $resnum = -99; while () { #skip comments next if /^#/; chomp; @inline = split; if ($inline[0] != $resnum){ $resnum = $inline[0]; if ($inline[0] == 0){ $patnum = 999 } else { $patnum = $inline[0] } print "PATTERN pa$patnum\n"; } #fix atom names $atmname = $inline[2]; if ($inline[1] eq "THR" || $inline[1] eq "CYS" || $inline[1] eq "SER"){ if ($inline[2] =~ /HG/){ $atmname = "HG1"; } } elsif ($inline[1] eq "ILE"){ if ( $inline[2] eq "MD1" ){ $atmname = "HD11"; } if ( $inline[2] eq "MG2" ){ $atmname = "HG21"; } } elsif ($inline[1] eq "LEU"){ if ($inline[2] eq "MD+" || $inline[2] eq "MD1"){ $atmname = "HD11"; } elsif ($inline[2] eq "MD-" || $inline[2] eq "MD2"){ $atmname = "HD21"; } } elsif ($inline[1] eq "ALA"){ if ($inline[2] eq "MB"){ $atmname = "HB1"; } } elsif ($inline[1] eq "VAL"){ if ($inline[2] eq "MG+" || $inline[2] eq "MG1"){ $atmname = "HG11"; } elsif ($inline[2] eq "MG-" || $inline[2] eq "MG2"){ $atmname = "HG21"; } } $atmname =~ s/\+/1/; $atmname =~ s/\-/2/; $atmtype = substr($inline[2],0,1); print "1:$inline[1]_$inline[0]:$atmname $inline[3] $atmtype\n"; } close (ASSIGFILE);