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

Diff of /FigWebServices/subsys.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.95, Tue Jul 26 04:54:27 2005 UTC revision 1.96, Thu Jul 28 20:50:05 2005 UTC
# Line 1147  Line 1147 
1147      my($fig,$cgi,$html,$subsystem,$can_alter) = @_;      my($fig,$cgi,$html,$subsystem,$can_alter) = @_;
1148      my($i);      my($i);
1149    
1150      my $col_hdrs = ["Column","Abbrev","Functional Role"];      my $sub_dir = $subsystem->get_dir;
1151      my $tab = [];  
1152        my $reactions = undef;
1153        if (open(REACT,"<$sub_dir/reactions"))
1154        {
1155            while (defined($_ = <REACT>))
1156            {
1157                if ($_ =~ /^(\S.*\S)\t(\S+)/)
1158                {
1159                    push(@{$reactions->{$1}},split(/,/,$2));
1160                }
1161            }
1162            close(REACT);
1163        }
1164    
1165      my $n = 1;      my $n = 1;
1166      &format_existing_roles($fig,$cgi,$html,$subsystem,$tab,\$n,$can_alter);      my $col_hdrs = $reactions ? ["Column","Abbrev","Functional Role","Reactions"] : ["Column","Abbrev","Functional Role"];
1167        my $tab = [];
1168    
1169        &format_existing_roles($fig,$cgi,$html,$subsystem,$tab,\$n,$can_alter,$reactions);
1170      if ($cgi->param('can_alter'))      if ($cgi->param('can_alter'))
1171      {      {
1172          for ($i=0; ($i < 5); $i++)          for ($i=0; ($i < 5); $i++)
1173          {          {
1174              &format_role($fig,$cgi,$html,$subsystem,$tab,$n,"",$can_alter);              &format_role($fig,$cgi,$html,$subsystem,$tab,$n,"",$can_alter,undef);
1175              $n++;              $n++;
1176          }          }
1177      }      }
# Line 1166  Line 1181 
1181  }  }
1182    
1183  sub format_existing_roles {  sub format_existing_roles {
1184      my($fig,$cgi,$html,$subsystem,$tab,$nP,$can_alter) = @_;      my($fig,$cgi,$html,$subsystem,$tab,$nP,$can_alter,$reactions) = @_;
1185      my($role);      my($role);
1186    
1187      foreach $role ($subsystem->get_roles)      foreach $role ($subsystem->get_roles)
1188      {      {
1189          &format_role($fig,$cgi,$html,$subsystem,$tab,$$nP,$role,$can_alter);          &format_role($fig,$cgi,$html,$subsystem,$tab,$$nP,$role,$can_alter,$reactions->{$role});
1190          $$nP++;          $$nP++;
1191      }      }
1192  }  }
1193    
1194    sub kegg_reaction_link {
1195        my($reaction) = @_;
1196    
1197        if ($reaction =~ /^R\d+/)
1198        {
1199            return "<a href=\"http://www.genome.ad.jp/dbget-bin/www_bget?rn+$reaction\">$reaction</a>";
1200        }
1201        return $reaction;
1202    }
1203    
1204  sub format_role {  sub format_role {
1205      my($fig,$cgi,$html,$subsystem,$tab,$n,$role,$can_alter) = @_;      my($fig,$cgi,$html,$subsystem,$tab,$n,$role,$can_alter,$reactions) = @_;
1206      my($abbrev);      my($abbrev,$reactT);
1207    
1208        my $react = $reactions ? join(",", map { &kegg_reaction_link($_) } @$reactions) : "";
1209    
1210      $abbrev = $role ? $subsystem->get_role_abbr($subsystem->get_role_index($role)) : "";      $abbrev = $role ? $subsystem->get_role_abbr($subsystem->get_role_index($role)) : "";
1211    
# Line 1188  Line 1215 
1215          $posT = $cgi->textfield(-name => "posR$n", -size => 3, -value => $n, -override => 1);          $posT = $cgi->textfield(-name => "posR$n", -size => 3, -value => $n, -override => 1);
1216          $abbrevT = $cgi->textfield(-name => "abbrev$n", -size => 7, -value => $abbrev, -override => 1);          $abbrevT = $cgi->textfield(-name => "abbrev$n", -size => 7, -value => $abbrev, -override => 1);
1217          $roleT = $cgi->textfield(-name => "role$n", -size => 80, -value => $role, -override => 1);          $roleT = $cgi->textfield(-name => "role$n", -size => 80, -value => $role, -override => 1);
1218            $reactT = $react;
1219      }      }
1220      else      else
1221      {      {
# Line 1197  Line 1225 
1225          $posT = $n;          $posT = $n;
1226          $abbrevT = $abbrev;          $abbrevT = $abbrev;
1227          $roleT = $role;          $roleT = $role;
1228            $reactT = $react;
1229      }      }
1230      #      #
1231      # Wrap the first element in the table with a <A NAME="role_rolename"> tag      # Wrap the first element in the table with a <A NAME="role_rolename"> tag
# Line 1214  Line 1243 
1243      }      }
1244    
1245    
1246      push(@$tab,[$posT_html,$abbrevT,$roleT]);      push(@$tab,[$posT_html,$abbrevT,$roleT,$reactT]);
1247    
1248      if ($cgi->param('check_problems'))      if ($cgi->param('check_problems'))
1249      {      {

Legend:
Removed from v.1.95  
changed lines
  Added in v.1.96

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3