[Bio] / FigKernelScripts / similar_to.pl Repository:
ViewVC logotype

View of /FigKernelScripts/similar_to.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Fri Aug 13 19:58:57 2004 UTC (15 years, 9 months ago) by overbeek
Branch: MAIN
CVS Tags: merge-trunktag-bobdev_news-2, Root-bobdev_news, merge-bobdev_news-1, caBIG-dataload-0, merge-trunktag-bobdev_news-1, merge-bodev_news-3, efrank-preMakefileToStandardMk, caBIG-00-00-00, merge-bobdev_news-2, merge-trunktag-bodev_news-3
Branch point for: Branch-bobdev_news
Changes since 1.2: +3 -0 lines
add error stream for hits as tool runs in similar_to

use FIG;
my $fig = new FIG;

use Sim;

my $usage = "usage: similar_to [CutOff] < PEG > PEG1-Sc-PEG";

my($cutoff,$pair,$peg);
$cutoff = shift @ARGV;
$cutoff = defined($cutoff) ? $cutoff : 1.0e-10;

my $id;
@pegs = map { chop; $_ =~ /(\S+)$/; 
	      $id = $1;  
	      if ($id =~ /^fig\|/)
	      {
		  $id;
	      }
	      else
	      {
		  if ($peg = $fig->by_alias($id))
		  {
		      $peg;
		  }
		  else
		  {
		      ();
		  }
	      }
            } <STDIN>;

foreach $peg (@pegs)
{
    if (! $seen{$peg})
    {
	$seen{$peg} = 1;
	foreach $sim ($fig->sims($peg,1000,$cutoff,"fig"))
	{
	    push(@hits,[$peg,$sim->psc,$sim->id2]);
	    my $sc = $sim->psc;
	    my $id2 = $sim->id2;
	    print STDERR "$peg\t$sc\t$id2\n";
	}
    }
}

foreach $x (sort { $a->[1] <=> $b->[1] } @hits)
{
    print join("\t",@$x),"\n";
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3