#!/usr/bin/perl #Perl script to sort DDM entries by size #Input file format is MSI rstrnt file (such as the output #from Randy Ketchem's ddmrstrnt perl script #M. Nelson 4/7/98 #read through the rstrnt file, making a hash of DDM entries with the two #residues involved combined to form the key open (DDMFILE, $ARGV[0]) || die "Cannot open rstrnt file"; $x = 0; while (){ chomp; @curr_line = split; ($junk1,$res1,$junk2) = split(/:/,$curr_line[0]); ($junk1,$res2,$junk2) = split(/:/,$curr_line[1]); $res1 =~ s/_//; $res2 =~ s/_//; $hashkey = "$res1"."_"."$res2"; $ddm_entries{"$hashkey"} = $curr_line[2]; } #sort the ddm_entries by size @sorted_ddm = sort { $ddm_entries{$a} <=> $ddm_entries{$b} } keys %ddm_entries; #print out the DDM entries in the new order foreach $a (@sorted_ddm){ ($res1, $res2) = split(/_/,$a); printf("%-6s %-6s %8.3f\n", $res1, $res2, $ddm_entries{$a}); #print "$a, $ddm_entries{$a}\n"; }