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

Annotation of /FigKernelScripts/make_assignments_fit_initial_css.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 :     $usage = "usage: make_assignments_fit_initial_css Prefix RecommenedAssignments Abbr1 Abbr2 ....";
23 :    
24 :     (
25 :     ($prefix = shift @ARGV) &&
26 : overbeek 1.3 ($assF = shift @ARGV) && open(ASSF,">$assF")
27 : overbeek 1.1 )
28 :     || die $usage;
29 :    
30 :     %change = map { $_ => 1 } @ARGV;
31 :    
32 :     $/ = "\n//\n";
33 :     $_ = <STDIN>;
34 :     print $_;
35 :    
36 :     ($roles = <STDIN>) || die "bad input file";
37 :     chomp $roles;
38 :     @roles = map { $_ =~ /^(\S+)\t(\S.*\S)/; [$1,$change{$1} ? "$prefix: $2" : $2] } split(/\n/,$roles);
39 :     for ($i=0; ($i < @roles); $i++)
40 :     {
41 :     ($abbr,$role) = @{$roles[$i]};
42 :     print "$abbr\t$role\n";
43 :     }
44 : overbeek 1.2 print "//\n";
45 :    
46 : overbeek 1.1 $/ = "\n";
47 :    
48 :     while (defined($_ = <STDIN>) && ($_ !~ /^\/\//))
49 :     {
50 :     print $_;
51 :     chop;
52 :     @flds = split(/\t/,$_);
53 :     $genome = $flds[0];
54 :    
55 :     undef %must_be;
56 :     for ($i=2; ($i < @flds); $i++)
57 :     {
58 :     if ($flds[$i])
59 :     {
60 :     foreach $peg (split(/,/,$flds[$i]))
61 :     {
62 :     push(@{$must_be{$peg}},$roles[$i-2]->[1]);
63 :     }
64 :     }
65 :     }
66 :    
67 :     foreach $pegN (keys(%must_be))
68 :     {
69 :     $peg = "fig|$genome.peg.$pegN";
70 :     $func = $fig->function_of($peg);
71 :     @funcs = split(/ [\@\/] |;\s+/,$func);
72 :     @needed = @{$must_be{$pegN}};
73 :    
74 :     for ($i=0,$ok=1; ($i < @needed) && $ok; $i++)
75 :     {
76 :     for ($j=0; ($j < @funcs) && ($funcs[$j] ne $needed[$i]); $j++) {}
77 :     $ok = ($j < @funcs);
78 :     }
79 :     if (! $ok)
80 :     {
81 :     print ASSF "$peg\t",join(" / ",@needed),"\n";
82 :     }
83 :     }
84 :     }
85 :     close(ASSF);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3