[Bio] / FigWebServices / split_functional_role.cgi Repository:
ViewVC logotype

Annotation of /FigWebServices/split_functional_role.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download)

1 : overbeek 1.1 # -*- perl -*-
2 :     #
3 :     # Copyright (c) 1003-1006 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 :     use FIG;
20 :     my $fig = new FIG;
21 :     use CGI;
22 :     my $cgi = new CGI;
23 :    
24 :     if (0) {
25 :     my $VAR1;
26 :     eval(join("",`cat /tmp/split_functional_role_parms`));
27 :     $cgi = $VAR1;
28 :     # print STDERR &Dumper($cgi);
29 :     }
30 :    
31 :     if (0) {
32 :     print $cgi->header;
33 :     my @params = $cgi->param;
34 :     print "<pre>\n";
35 :     foreach $_ (@params) {
36 :     print "$_\t:",join(",",$cgi->param($_)),":\n";
37 :     }
38 :    
39 :     if (0) {
40 :     if (open(TMP,">/tmp/split_functional_role_parms")) {
41 :     print TMP &Dumper($cgi);
42 :     close(TMP);
43 :     }
44 :     }
45 :     exit;
46 :     }
47 :    
48 :     use HTML;
49 :     my $html = [];
50 :    
51 :     my $to_split = $cgi->param('to_split');
52 :     my @param = grep { $_ =~ /^set\d+$/ } $cgi->param;
53 :     my @set = ();
54 :     foreach $_ (@param)
55 :     {
56 :     my $val = $cgi->param($_);
57 :     if ($val =~ /\S/)
58 :     {
59 :     $val =~ s/^\s+//;
60 :     $val =~ s/\s+$//;
61 :     push(@set,$val);
62 :     }
63 :     }
64 :    
65 :     my(@subs);
66 :     if ($to_split)
67 :     {
68 :     my %subs = map { $_->[0] => 1 } grep { ($_->[1] eq $to_split) } $fig->subsystems_for_role($to_split);
69 :     @subs = sort keys(%subs);
70 :     }
71 :    
72 :     if ($to_split && (@subs > 0) && (@set > 1))
73 :     {
74 :     my $sub;
75 :     foreach $sub (@subs)
76 :     {
77 :     my $subsystem = new Subsystem($sub,$fig,0);
78 :     my @roles = $subsystem->get_roles;
79 :     my $which = $subsystem->get_role_index($to_split);
80 :     @roles = map { [$_,$subsystem->get_role_abbr($subsystem->get_role_index($_))] } @roles;
81 :    
82 :     if (my $abbrev = $subsystem->get_role_abbr($which))
83 :     {
84 :     my $n = 1;
85 :     my @to_add = ();
86 :     for ($i=0; ($i < @set); $i++)
87 :     {
88 :     push(@to_add,[$set[$i],"$abbrev-$n"]);
89 :     $n++;
90 :     }
91 :     splice(@roles,$which,1,@to_add);
92 :     $subsystem->set_roles(\@roles);
93 :     $subsystem->set_subsetC("\*$abbrev",[map { $_->[0] } @to_add]);
94 :     $subsystem->write_subsystem;
95 :     push(@$html,$cgi->h2("split in $sub"));
96 :     }
97 :     else
98 :     {
99 :     push(@$html,$cgi->h1("*** could not split in $sub"),"\n");
100 :     }
101 :     }
102 :     }
103 :     else
104 :     {
105 :     push(@$html,$cgi->start_form(-action=>"split_functional_role.cgi"),
106 :     "Role to Split: ",$cgi->textfield( -name => "to_split", -size => 100 ),$cgi->br,$cgi->br,
107 :     "Set 1: ",$cgi->textfield( -name => "set1", -size => 100 ),$cgi->br,
108 :     "Set 2: ",$cgi->textfield( -name => "set2", -size => 100 ),$cgi->br,
109 :     "Set 3: ",$cgi->textfield( -name => "set3", -size => 100 ),$cgi->br,
110 :     "Set 4: ",$cgi->textfield( -name => "set4", -size => 100 ),$cgi->br,
111 :     "Set 5: ",$cgi->textfield( -name => "set5", -size => 100 ),$cgi->br,
112 :     "Set 6: ",$cgi->textfield( -name => "set6", -size => 100 ),$cgi->br,
113 :     "Set 7: ",$cgi->textfield( -name => "set7", -size => 100 ),$cgi->br,
114 :     "Set 8: ",$cgi->textfield( -name => "set8", -size => 100 ),$cgi->br,
115 :     "Set 9: ",$cgi->textfield( -name => "set9", -size => 100 ),$cgi->br,
116 :     "Set 10: ",$cgi->textfield( -name => "set10", -size => 100 ),$cgi->br,
117 :     "Set 11: ",$cgi->textfield( -name => "set11", -size => 100 ),$cgi->br,
118 :     "Set 12: ",$cgi->textfield( -name => "set12", -size => 100 ),$cgi->br,
119 :     "Set 13: ",$cgi->textfield( -name => "set13", -size => 100 ),$cgi->br,
120 :     "Set 14: ",$cgi->textfield( -name => "set14", -size => 100 ),$cgi->br,
121 :     "Set 15: ",$cgi->textfield( -name => "set15", -size => 100 ),$cgi->br,
122 :     "Set 16: ",$cgi->textfield( -name => "set16", -size => 100 ),$cgi->br,
123 :     "Set 17: ",$cgi->textfield( -name => "set17", -size => 100 ),$cgi->br,
124 :     "Set 18: ",$cgi->textfield( -name => "set18", -size => 100 ),$cgi->br,
125 :     "Set 19: ",$cgi->textfield( -name => "set19", -size => 100 ),$cgi->br,
126 :     "Set 20: ",$cgi->textfield( -name => "set20", -size => 100 ),$cgi->br,
127 :     $cgi->submit('Split'),
128 :     $cgi->end_form
129 :     );
130 :     }
131 :    
132 :     &HTML::show_page($cgi,$html);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3