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

Annotation of /FigKernelScripts/relevant_pchsG.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
19 :     use FIG;
20 :     my $fig = new FIG;
21 :    
22 :     use DBrtns;
23 :     my $dbh = $fig->db_handle;
24 :    
25 :     $usage = "usage: relevant_pchs Genome";
26 :    
27 :     (
28 :     ($genome = shift @ARGV)
29 :     )
30 :     || die $usage;
31 :    
32 : olson 1.3 if ($genome =~ /^\d+\.\d+$/)
33 :     {
34 :     my $mg = $fig->map_genome_to_id($genome);
35 :     print STDERR "Mapped $genome to $mg\n";
36 :     $genome = $mg;
37 :     }
38 :     elsif ($genome =~ /^\d+$/)
39 :     {
40 :     my $g = $fig->map_id_to_genome($genome);
41 :     print STDERR "Using mapped genome $g\n";
42 :     }
43 :     else
44 :     {
45 :     die "Invalid genome identifier\n";
46 :     }
47 :    
48 :    
49 : olson 1.2 my $qry = qq(SELECT r1.g1, r1.p1,
50 :     r1.g2, r1.p2,
51 :     r2.g2, r2.p2,
52 :     r3.g2, r3.p2,
53 :     r2.iden, r3.iden, r2.paraN, r3.paraN
54 :     FROM close_pegs r1, condensed_sims r2, condensed_sims r3, close_pegs r4
55 :     WHERE (r1.g1 = $genome AND
56 :     r1.g1 = r2.g1 AND
57 :     r1.p1 = r2.p1 AND
58 :    
59 :     r1.g2 = r3.g1 AND
60 :     r1.p2 = r3.p1 AND
61 :    
62 :     r4.g1 = r2.g2 AND
63 :     r4.p1 = r2.p2 AND
64 :    
65 :     r4.g2 = r3.g2 AND
66 :     r4.p2 = r3.p2)
67 :     );
68 :    
69 :     if (($res = $dbh->SQL($qry)) &&
70 : overbeek 1.1 (@$res > 0))
71 :     {
72 : olson 1.2 foreach $x (sort { ($a->[0] <=> $b->[0]) or ($a->[1] <=> $b->[1]) or ($a->[2] <=> $b->[2]) or
73 :     ($a->[3] <=> $b->[3]) or ($b->[8] <=> $a->[8]) } @$res)
74 : overbeek 1.1 {
75 :     print join("\t",@$x),"\n";
76 :     }
77 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3