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

Diff of /FigWebServices/subsys_summary.cgi

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

revision 1.3, Sat Feb 12 20:18:22 2005 UTC revision 1.4, Sat Feb 12 21:38:27 2005 UTC
# Line 100  Line 100 
100    
101    # start a new row for this data    # start a new row for this data
102    # tablerows is a refence to an array.    # tablerows is a refence to an array.
103    # each element is an array of tablecells with the following values colspan rowspan value    # each element is an array of tablecells with the following values value colspan rowspan width
104      # if colspan or rowspan are undef they are believed to be 1
105      # if width is ommitted it is ignored
106    
107    my $tablerows;    my $tablerows;
108    
109    # get the classification if required    # get the classification if required
# Line 114  Line 117 
117     @$class=($$class[0], $$class[1]); # could have done this with splice. Ech.     @$class=($$class[0], $$class[1]); # could have done this with splice. Ech.
118    
119     foreach my $c (@$class) {     foreach my $c (@$class) {
120      push @$tablerows, ['1', $rows, $c];      push @$tablerows, [$c, 1, $rows];
121     }     }
122    }    }
123    
124    # add the subsystem to the table    # add the subsystem to the table
125    push @$tablerows, ['1', $rows, "<strong>$subsys<strong>"];    push @$tablerows, ["<strong>$subsys<strong>", '1', $rows];
126    
127    # add the genomes in the subsystem    # add the genomes in the subsystem
128    if ($cgi->param('genomes') && $cgi->param('stats')) {push @$tablerows, ['1', $rows, (scalar keys %genomes)]}    if ($cgi->param('genomes') && $cgi->param('stats')) {push @$tablerows, [(scalar keys %genomes), '1', $rows]}
129    elsif ($cgi->param('genomes')) {    elsif ($cgi->param('genomes')) {
130     my $c=join "<br>\n", sort {$a cmp $b} values %genomes;     my $c=join "<br>\n", sort {$a cmp $b} values %genomes;
131     push @$tablerows, ['1', $rows, $c];     push @$tablerows, [$c, 1, $rows];
132    }    }
133    
134    
# Line 145  Line 148 
148    my $pegcount;    my $pegcount;
149    my $toadd; #this is what we will add if we need to    my $toadd; #this is what we will add if we need to
150    if ($cgi->param('stats')) {    if ($cgi->param('stats')) {
151     push @$tablerows, ['1', $rows, (scalar @roles)];     push @$tablerows, [(scalar @roles), '1', $rows];
152     my $totalpegs;     my $totalpegs;
153     # there should be a quicker way of getting this ... ?     # there should be a quicker way of getting this ... ?
154     foreach my $role (@roles) {     foreach my $role (@roles) {
# Line 156  Line 159 
159      }      }
160     }     }
161    
162     push @$tablerows, ['1', $rows, $totalpegs];     push @$tablerows, [$totalpegs, '1', $rows];
163     foreach my $w (@wants) {     foreach my $w (@wants) {
164      push @$tablerows, ['1', $rows, $pegcount->{$w}]; # pegs for each of the chosen genomes      push @$tablerows, [$pegcount->{$w}, '1', $rows]; # pegs for each of the chosen genomes
165     }     }
166     push @$toadd, $tablerows;     push @$toadd, $tablerows;
167    }    }
168    elsif ($cgi->param('korgs')) {    elsif ($cgi->param('korgs')) {
    # now add the roles  
169     my $first=1;     my $first=1;
170     foreach my $role (@roles) {     foreach my $role (@roles) {
171      my $genomeroles;      my $genomeroles;
# Line 174  Line 176 
176         $cell .= &HTML::fid_link($cgi,$peg) . "; ";         $cell .= &HTML::fid_link($cgi,$peg) . "; ";
177        }        }
178       }       }
179       push @$genomeroles, [1, 1, $cell];       push @$genomeroles, [$cell, 1, 1];
180      }      }
181      # because I am using rowspan to make long columns, we don't want the tr on the first of these.      # because I am using rowspan to make long columns, we don't want the tr on the first of these.
182      if ($first) {      if ($first) {
183       push @$tablerows, (['1', '1', $role], @$genomeroles);       push @$tablerows, ([$role, 1, 1], @$genomeroles);
184       push @$toadd, $tablerows;       push @$toadd, @$tablerows;
185    print STDERR "Added first $role\n";
186    print STDERR "After FIRST TOADD: ", join " ", @$toadd, "\n";
187         undef $first;
188      }      }
189      else {      else {
190       my $tr=[('1', '1', $role), @$genomeroles];       my @tr=([$role, 1, 1], @$genomeroles);
191       push @$toadd, $tr;       push @$toadd, \@tr;
192    print STDERR "Added second  $role\n";
193    print STDERR "After second TOADD: ", join " ", @$toadd, "\n";
194      }      }
195     }     }
196    }    }
# Line 204  Line 211 
211    
212   # now convert $table into a table   # now convert $table into a table
213    
214     # sort the table
215     # if we have levels we want to sort on level 1 and then level 2 and then subsysname
216     # if not, we just sort on subsys name
217     if ($cgi->param("levels")) {
218      @$table = sort {
219       $a->[0]->[0] cmp $b->[0]->[0]
220                    ||
221       $a->[1]->[0] cmp $b->[1]->[0]
222                    ||
223       $a->[2]->[0] cmp $b->[2]->[0]
224      } @$table;
225     }
226     else {
227      @$table = sort {
228       $a->[0]->[0] cmp $b->[0]->[0]
229      } @$table;
230     }
231    
232    
233   my $tab;   my $tab;
234   foreach my $row (@$table) {   foreach my $row (@$table) {
235    $tab .= "\n<tr>";    $tab .= "\n<tr>";
236    foreach my $cell (@$row) {    foreach my $cell (@$row) {
237     $tab .= "\n\t<td colspan=$cell->[0] rowspan=$cell->[1]>$cell->[2]</td>";  unless (ref($cell) eq "ARRAY") {
238     print STDERR "Didn't work. This is what we have for the row: ", join "\n", @$row, "\n";
239     exit(-1);
240    }
241       $tab .= "\n\t<td valign=top colspan=$cell->[1] rowspan=$cell->[2]>$cell->[0]</td>";
242    }    }
243    $tab .= "\n</tr>\n";    $tab .= "\n</tr>\n";
244   }   }
# Line 303  Line 333 
333                    $cgi->checkbox(-name=>"stats", -label=>"Only show statistics", -checked=>'on'), $cgi->p,                    $cgi->checkbox(-name=>"stats", -label=>"Only show statistics", -checked=>'on'), $cgi->p,
334                    $cgi->checkbox(-name=>"levels", -label=>"Show subsystem classification", -checked=>'on'), $cgi->p,                    $cgi->checkbox(-name=>"levels", -label=>"Show subsystem classification", -checked=>'on'), $cgi->p,
335                    $cgi->checkbox(-name=>"genomes", -label=>"Show genomes in subsystem", -checked=>'on'), $cgi->p,                    $cgi->checkbox(-name=>"genomes", -label=>"Show genomes in subsystem", -checked=>'on'), $cgi->p,
336                    $cgi->checkbox(-name=>"haveroles", -label=>"Show only subsystems that have roles defined", -checked=>'on'), $cgi->p,                    $cgi->checkbox(-name=>"haveroles", -label=>"Show only subsystems that have roles defined"), $cgi->p,
337                    $cgi->checkbox(-name=>"orgpegs", -label=>"Show only subsystems that have roles in the organism(s) you have chosen", -checked=>'on'), $cgi->p,                    $cgi->checkbox(-name=>"orgpegs", -label=>"Show only subsystems that have roles in the organism(s) you have chosen"), $cgi->p,
338    
339                    $cgi->end_form,                    $cgi->end_form,
340    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3