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

Annotation of /FigKernelScripts/similar_to.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download) (as text)

1 : olson 1.4 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 : overbeek 1.1 use FIG;
19 :     my $fig = new FIG;
20 :    
21 :     use Sim;
22 :    
23 : overbeek 1.2 my $usage = "usage: similar_to [CutOff] < PEG > PEG1-Sc-PEG";
24 : overbeek 1.1
25 :     my($cutoff,$pair,$peg);
26 :     $cutoff = shift @ARGV;
27 :     $cutoff = defined($cutoff) ? $cutoff : 1.0e-10;
28 :    
29 :     my $id;
30 :     @pegs = map { chop; $_ =~ /(\S+)$/;
31 :     $id = $1;
32 :     if ($id =~ /^fig\|/)
33 :     {
34 :     $id;
35 :     }
36 :     else
37 :     {
38 :     if ($peg = $fig->by_alias($id))
39 :     {
40 :     $peg;
41 :     }
42 :     else
43 :     {
44 :     ();
45 :     }
46 :     }
47 :     } <STDIN>;
48 :    
49 : overbeek 1.2 foreach $peg (@pegs)
50 : overbeek 1.1 {
51 : overbeek 1.2 if (! $seen{$peg})
52 : overbeek 1.1 {
53 : overbeek 1.2 $seen{$peg} = 1;
54 :     foreach $sim ($fig->sims($peg,1000,$cutoff,"fig"))
55 :     {
56 :     push(@hits,[$peg,$sim->psc,$sim->id2]);
57 : overbeek 1.3 my $sc = $sim->psc;
58 :     my $id2 = $sim->id2;
59 :     print STDERR "$peg\t$sc\t$id2\n";
60 : overbeek 1.2 }
61 : overbeek 1.1 }
62 :     }
63 :    
64 :     foreach $x (sort { $a->[1] <=> $b->[1] } @hits)
65 :     {
66 :     print join("\t",@$x),"\n";
67 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3