#!/usr/bin/perl # Randal R. Ketchem, Ph.D. 619.784.9879 (voice1) # Department of Molecular Biology, MB-9 619.784.8754 (voice2) # The Scripps Research Institute 619.784.9985 (FAX) # 10550 N. Torrey Pines Road ketchemr@scripps.edu (email) # La Jolla, CA 92037-1027 http://www.scripps.edu/~ketchemr # noevio file: ## ATOM A ATOM B BOUND MT AVE +- RMS : per structure # 19 TYR CZ 13 ILE MD 0.01 1D 14.11 +- 1.94 : 15.23 12.39 13.02 11.91 15.81 10.93 17.79 14.76 14.58 14.66 # ar_ambig:1 # The peak number is in the comment field as "peak file name:peak number". require "ctime.pl"; require "getopt.pl"; if($#ARGV != 5) { $prgName = `basename $0`; chop($prgName); die < out] EOHELP } &Getopt('bnp'); @bins = reverse sort bynumber split(' ', $opt_b); $numPeaks = $opt_n; $numPeaks = 1 if(!$numPeaks); $noevioFile = $opt_p; $commentPeakFile = $noevioFile; $commentPeakFile =~ s/.*\///; open(NOEVIOFILE, $noevioFile) || die("Cannot open $noevioFile: $!\n"); while() { next if(/^\s*#/); next if(/^\s*$/); chop; $peakNum = $_; $peakNum =~ s/.*://; $peakNum =~ s/ .*//; $count{$peakNum}++; } close(NOEVIOFILE); $countPeaks = 0; foreach (sort bynumber keys %count) { ++$countPeaks if($count{$_} == $numPeaks); } sub bynumber { $a <=> $b; } $date = &ctime(time); print "# Date: $date"; print "# Peak File: $commentPeakFile\n"; print "# bins:"; foreach $bin (@bins) { print " $bin"; } print "\n"; print "# Number to match: $numPeaks\n"; print "# Number of matches: $countPeaks\n"; #print "# ATOM 1 ATOM 2 distance # peak file:peak #\n"; print "# ATOM A ATOM B BOUND MTD AVE +- RMS"; print " : each : input comment\n"; open(NOEVIOFILE, $noevioFile) || die("Cannot open $noevioFile: $!\n"); while() { next if(/^\s*#/); next if(/^\s*$/); chop; # 19 TYR CZ 13 ILE MD 0.01 1D 14.11 +- 1.94 : 15.23 12.39 13.02 11.91 15.81 10.93 17.79 14.76 14.58 14.66 # ar_ambig:1 $peakNum = $_; $peakNum =~ s/.*://; $peakNum =~ s/ .*//; @words = split; $mark = ""; if($count{$peakNum} == $numPeaks) { $avg = $words[8]; foreach $bin (@bins) { $mark .= "*" if($avg <= $bin); } # while(length($mark) < scalar(@bins)) { $mark .= " "; } print "\n" if($peakNum != $oldPeakNum); $oldPeakNum = $peakNum; print "$_"; print " $mark" if($mark); print "\n"; } } close(NOEVIOFILE);