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

Annotation of /FigKernelScripts/generate_pinned_homologs.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : efrank 1.1 # -*- perl -*-
2 : olson 1.2 #
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 :     #
8 :     # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 :     # Public License.
11 :     #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     #
18 :    
19 : efrank 1.1 use Carp;
20 :     use Data::Dumper;
21 :     use Time::HiRes qw(gettimeofday);
22 :    
23 :     use FIG;
24 :    
25 :     my $fig = new FIG;
26 :    
27 :     my $usage = "usage:generate_pinned_homologs CoupledPairs [Org1 Org2 Org3 ...] > pinned";
28 :    
29 :     (($coupledF = shift @ARGV) && open(COUPLED,">$coupledF"))
30 :     || die $usage;
31 :    
32 :     if (@ARGV > 0)
33 :     {
34 :     foreach $org (@ARGV)
35 :     {
36 :     push(@pegs,sort { &FIG::by_fig_id($a,$b) } $fig->all_features($org,"peg"));
37 :     }
38 :     }
39 :     else
40 :     {
41 :     @pegs = <STDIN>;
42 :     chomp @pegs;
43 :     }
44 :    
45 :     $bound = 5000;
46 :     $sim_cutoff = 1.0e-20;
47 :     $coupling_cutoff = 1;
48 :    
49 :     foreach $peg1 (@pegs)
50 :     {
51 :     next if (($peg1 =~ /^fig\|(\d+\.\d+)/) && ($fig->taxonomy_of($1) =~ /^Euk/));
52 :     @tmp = $fig->coupling_and_evidence($peg1,$bound,$sim_cutoff,$coupling_cutoff);
53 :     undef %orgs;
54 :     foreach $x (@tmp)
55 :     {
56 :     ($sc,$neigh,$pairs) = @$x;
57 :     print "$neigh\t",join("\t",map { $_->[1] } @$pairs),"\n";
58 :    
59 :     print COUPLED "$peg1\t$sc\t$neigh\n";
60 :     foreach $_ (@$pairs)
61 :     {
62 :     print COUPLED "$_->[0]\t$sc\t$_->[1]\n";
63 :     }
64 :    
65 :     foreach $peg2 (map { $_->[0] } @$pairs)
66 :     {
67 :     if ($peg2 =~ /^fig\|(\d+\.\d+)/)
68 :     {
69 :     $org2 = $1;
70 :     $orgs{$org2}->{$peg2} = 1;
71 :     }
72 :     }
73 :     }
74 :     @corr = ();
75 :     @orgs = keys(%orgs);
76 :     if (@orgs > 0)
77 :     {
78 :     foreach $org (sort { $a <=> $b } @orgs)
79 :     {
80 :     $pegs = join(",",sort { &FIG::by_fig_id($a,$b) } keys(%{$orgs{$org}}));
81 :     push(@corr,$pegs);
82 :     }
83 :     print "$peg1\t",join("\t",@corr),"\n";
84 :     }
85 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3