[Bio] / SubsystemEditor / WebPage / ShowVariants.pm Repository:
ViewVC logotype

Diff of /SubsystemEditor/WebPage/ShowVariants.pm

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

revision 1.2, Fri Aug 31 20:43:46 2007 UTC revision 1.13, Sat Jan 29 22:28:01 2011 UTC
# Line 21  Line 21 
21    
22    $self->application->register_component(  'Table', 'ShowVariantsTable'  );    $self->application->register_component(  'Table', 'ShowVariantsTable'  );
23    $self->application->register_component(  'Table', 'FRTable'  );    $self->application->register_component(  'Table', 'FRTable'  );
24      $self->application->register_component( 'Table', 'VarDescTable'  );
25      $self->application->register_component( 'Info', 'CommentInfo');
26  }  }
27    
28  sub require_javascript {  sub require_javascript {
# Line 35  Line 37 
37  sub output {  sub output {
38    my ( $self ) = @_;    my ( $self ) = @_;
39    
40    my $can_alter = 1;    my $can_alter = 0;
41      my $user = $self->application->session->user;
42    
43    my $fig = new FIG;    $self->{ 'fig' } = $self->application->data_handle( 'FIG' );
44    my $cgi = $self->application->cgi;    $self->{ 'cgi' } = $self->application->cgi;
45    
46    my $name = $cgi->param( 'subsystem' );    my $name = $self->{ 'cgi' }->param( 'subsystem' );
47    my $ssname = $name;    my $ssname = $name;
48      $name = uri_unescape( $name );
49    $ssname =~ s/\_/ /g;    $ssname =~ s/\_/ /g;
50    
51      my $esc_name = uri_escape($name);
52    
53      my $dbmaster = $self->application->dbmaster;
54      my $ppoapplication = $self->application->backend;
55    
56      # get a seeduser #
57      my $seeduser = '';
58      if ( defined( $user ) && ref( $user ) ) {
59        my $preferences = $dbmaster->Preferences->get_objects( { user => $user,
60                                                                 name => 'SeedUser',
61                                                                 application => $ppoapplication } );
62        if ( defined( $preferences->[0] ) ) {
63          $seeduser = $preferences->[0]->value();
64        }
65      }
66    
67      if ( $user && $user->has_right( $self->application, 'edit', 'subsystem', $name ) ) {
68        $can_alter = 1;
69        $self->{ 'fig' }->set_user( $seeduser );
70      }
71    
72    ######################    ######################
73    # Construct the menu #    # Construct the menu #
74    ######################    ######################
# Line 51  Line 76 
76    my $menu = $self->application->menu();    my $menu = $self->application->menu();
77    
78    # Build nice tab menu here    # Build nice tab menu here
79    $menu->add_category( 'Subsystem Info', "SubsysEditor.cgi?page=ShowSubsystem&subsystem=$name" );    $menu->add_category( 'Subsystem Info', "SubsysEditor.cgi?page=ShowSubsystem&subsystem=$esc_name" );
80    $menu->add_category( 'Functional Roles', "SubsysEditor.cgi?page=ShowFunctionalRoles&subsystem=$name" );    $menu->add_category( 'Functional Roles', "SubsysEditor.cgi?page=ShowFunctionalRoles&subsystem=$esc_name" );
81    $menu->add_category( 'Subsystem Diagram', "SubsysEditor.cgi?page=ShowDiagram&subsystem=$name" );    $menu->add_category( 'Diagrams and Illustrations' );
82    $menu->add_category( 'Subsystem Spreadsheet', "SubsysEditor.cgi?page=ShowSpreadsheet&subsystem=$name" );    $menu->add_entry( 'Diagrams and Illustrations', 'Diagram', "SubsysEditor.cgi?page=ShowDiagram&subsystem=$esc_name" );
83    $menu->add_category( 'Subsystem Check', "SubsysEditor.cgi?page=ShowCheck&subsystem=$name" );    $menu->add_entry( 'Diagrams and Illustrations', 'Illustrations', "SubsysEditor.cgi?page=ShowIllustrations&subsystem=$esc_name" );
84    $menu->add_category( 'Subsystem Tree', "SubsysEditor.cgi?page=ShowTree&subsystem=$name" );    $menu->add_category( 'Spreadsheet', "SubsysEditor.cgi?page=ShowSpreadsheet&subsystem=$esc_name" );
85      $menu->add_category( 'Show Check', "SubsysEditor.cgi?page=ShowCheck&subsystem=$esc_name" );
86      $menu->add_category( 'Show Connections', "SubsysEditor.cgi?page=ShowTree&subsystem=$esc_name" );
87    
88    
89    ##############################    ##############################
# Line 72  Line 99 
99      return $content;      return $content;
100    }    }
101    
102    my ( $datahash, $subsystem ) = get_data( $fig, $name );    $content .= $self->start_form();
103    
104      #### 100x100 ####
105      if ( defined( $self->{ 'cgi' }->param( 'on100x100' ) ) ) {
106        $self->{ 'cgi' }->param( 'hundred_hundred', 1 );
107      }
108      if ( defined( $self->{ 'cgi' }->param( 'off100x100' ) ) ) {
109        $self->{ 'cgi' }->param( 'hundred_hundred', 0 );
110      }
111    
112    
113      if ( !defined( $self->{ 'cgi' }->param( 'hundred_hundred' ) ) || $self->{ 'cgi' }->param( 'hundred_hundred' ) != 1 ) {
114        $content .= $self->{ 'cgi' }->submit( -name => "on100x100", -value => "Show only 100x100" );
115      }
116      else {
117        $content .= $self->{ 'cgi' }->submit( -name => "off100x100", -value => "Show all genomes" );
118      }
119    
120      my $subsystem = $self->{ 'fig' }->get_subsystem( $name );
121    
122      my $datahash = $self->get_data( $subsystem );
123    
124    my $application = $self->application;    my $application = $self->application;
125    
126    if ( $cgi->param( 'set_variants' ) ) {    if ( $self->{ 'cgi' }->param( 'set_variants' ) ) {
127      $comment .= '<BR>';      $comment .= '<BR>';
128      $comment .= set_variants( $cgi, $fig, $name, $subsystem, $application, $datahash );      $comment .= set_variants( $self, $name, $subsystem, $application, $datahash );
129      ( $datahash, $subsystem ) = get_data( $fig, $name );      $datahash = $self->get_data( $subsystem );
130      }
131      elsif ( $self->{ 'cgi' }->param( 'addsave_variants' ) ) {
132        my @varcodes = $self->{ 'cgi' }->param( 'VARIANT' );
133        my @vardescs = $self->{ 'cgi' }->param( 'VARIANTDESC' );
134        my %varhash;
135    
136        for ( my $i = 0; $i < scalar( @varcodes ); $i++ ) {
137    
138          if ( $varcodes[$i] eq '' ) {
139            if ( $vardescs[$i] ne '' ) {
140              $comment .= "No Variant Code given for description ".uri_unescape( $vardescs[$i] ).", so this variant could not be saved.<BR>\n";
141            }
142            next;
143          }
144          if ( defined( $varhash{ $varcodes[$i] } ) ) {
145            $comment .= "Variant ".$varcodes[$i]." already has the description ".$varhash{ $varcodes[$i] }.", so description ".uri_unescape( $vardescs[$i] )." was ignored.<BR>\n";
146            next;
147          }
148    
149          $varhash{ $varcodes[$i] } = uri_unescape( $vardescs[$i] );
150    }    }
151        my $newvarcode = $self->{ 'cgi' }->param( 'NEWVARIANT' );
152        my $newvardesc = $self->{ 'cgi' }->param( 'NEWVARIANTDESC' );
153        if ( defined( $newvarcode ) && $newvarcode ne '' && defined( $newvardesc ) && $newvardesc ne '' ) {
154          if ( $newvarcode eq '' ) {
155            if ( $newvarcode ne '' ) {
156              $comment .= "No Variant Code given for description ".uri_unescape( $newvardesc ).", so this variant could not be saved.<BR>\n";
157            }
158          }
159          elsif ( defined( $varhash{ $newvarcode } ) ) {
160            $comment .= "Variant $newvarcode already has the description ".uri_unescape( $newvardesc ).", so description ".uri_unescape( $newvardesc )." was ignored.<BR>\n";
161          }
162          else {
163            $varhash{ $newvarcode } = uri_unescape( $newvardesc );
164          }
165        }
166    
167        $subsystem->set_variants( \%varhash );
168        $subsystem->incr_version();
169        $subsystem->db_sync();
170        $subsystem->write_subsystem();
171      }
172    
173      if ( defined( $comment ) && $comment ne '' ) {
174        my $info_component = $application->component( 'CommentInfo' );
175    
176        $info_component->content( $comment );
177        $info_component->default( 0 );
178        $content .= $info_component->output();
179      }
180    
181    
182    $content .= show_variants( $self, $cgi, $fig, $name, $subsystem, $datahash );    $content .= show_variants( $self, $name, $subsystem, $can_alter, $datahash );
183    
184    ###############################    ###############################
185    # Display errors and comments #    # Display errors and comments #
# Line 91  Line 188 
188    if ( defined( $error ) && $error ne '' ) {    if ( defined( $error ) && $error ne '' ) {
189      $self->application->add_message( 'warning', $error );      $self->application->add_message( 'warning', $error );
190    }    }
   if ( defined( $comment ) && $comment ne '' ) {  
     $self->application->add_message( 'info', $comment );  
   }  
   
191    return $content;    return $content;
192  }  }
193    
# Line 102  Line 195 
195  # data method #  # data method #
196  ###############  ###############
197  sub get_data {  sub get_data {
198    my ( $fig, $name ) = @_;    my ( $self, $subsystem ) = @_;
199    
200    my $datahash = {};    my $datahash = {};
201    
   my $subsystem = $fig->get_subsystem( $name );  
202    my @genomes        = $subsystem->get_genomes;    my @genomes        = $subsystem->get_genomes;
203    
204      my %thesegenomes;
205    
206      if ( defined( $self->{ 'cgi' }->param( 'hundred_hundred' ) ) && $self->{ 'cgi' }->param( 'hundred_hundred' ) == 1 ) {
207        my %orgs = map { $_->[0] => 1 } grep { $_->[0] =~ /^\d+\.\d+$/ } $self->{ 'fig' }->get_attributes( undef, 'collection', 'hundred_hundred' );
208    
209        foreach my $g ( @genomes ) {
210          if ( defined( $orgs{ $g } ) ) {
211            $thesegenomes{ $g } = 1;
212          }
213        }
214        @genomes = keys %thesegenomes;
215      }
216    
217    my %variant_codes = map { $_ => $subsystem->get_variant_code( $subsystem->get_genome_index( $_ ) ) } @genomes;    my %variant_codes = map { $_ => $subsystem->get_variant_code( $subsystem->get_genome_index( $_ ) ) } @genomes;
218    my @roles          = $subsystem->get_roles;    my @roles          = $subsystem->get_roles;
219    
# Line 115  Line 221 
221    $datahash->{ 'varcodes' } = \%variant_codes;    $datahash->{ 'varcodes' } = \%variant_codes;
222    $datahash->{ 'roles' } = \@roles;    $datahash->{ 'roles' } = \@roles;
223    
224    return ( $datahash, $subsystem );    return $datahash;
225  }  }
226    
227  #########################################################  #########################################################
228  # show table with variants and button for changing them #  # show table with variants and button for changing them #
229  #########################################################  #########################################################
230  sub show_variants {  sub show_variants {
231    my ( $self, $cgi, $fig, $name, $sub, $datahash ) = @_;    my ( $self, $name, $sub, $can_alter, $datahash ) = @_;
232    
233    my $application = $self->application();    my $application = $self->application();
234    
# Line 133  Line 239 
239    my %variant_codes = %{ $datahash->{ 'varcodes' } };    my %variant_codes = %{ $datahash->{ 'varcodes' } };
240    my @roles          = @{ $datahash->{ 'roles' } };    my @roles          = @{ $datahash->{ 'roles' } };
241    
242    my ( $abbrev, $frtable ) = format_roles( $application, $fig, $cgi, $sub );    my ( $abbrev, $frtable ) = $self->format_roles( $sub );
243    
244    my( @has, $role, %has_filled );    my( @has, $role, %has_filled );
245    foreach my $genome ( @genomes ) {    foreach my $genome ( @genomes ) {
# Line 145  Line 251 
251      $has_filled{join(",",@has)}->{$variant_codes{$genome}}++;      $has_filled{join(",",@has)}->{$variant_codes{$genome}}++;
252    }    }
253    
254    my ( $col_hdrs, $tab, $pattern );    my ( $col_hdrs, $pattern_uq );
255      if ( $can_alter ) {
256    $col_hdrs = [ { name => "Pattern" }, { name => "# Genomes with Pattern" },    $col_hdrs = [ { name => "Pattern" }, { name => "# Genomes with Pattern" },
257                  { name => "Existing Variant Code" }, { name => "Set To" } ];                  { name => "Existing Variant Code" }, { name => "Set To" } ];
258    $tab = [];    }
259    foreach $pattern ( sort keys( %has_filled ) ) {    else {
260        $col_hdrs = [ { name => "Pattern" }, { name => "# Genomes with Pattern" },
261                      { name => "Existing Variant Code" } ];
262      }
263    
264      my $tab = [];
265      foreach $pattern_uq ( sort keys( %has_filled ) ) {
266    
267        my $pattern = quotemeta( $pattern_uq );
268    
269      my @codes = keys( %{ $has_filled{ $pattern } } );      my @codes = keys( %{ $has_filled{ $pattern_uq } } );
270      my $code;      my $code;
271      my $nrow = @codes;      my $nrow = @codes;
272      if ( @codes > 0 ) {      if ( @codes > 0 ) {
273        $code = shift @codes;        $code = shift @codes;
274        push( @$tab, [ $pattern,        if ( $can_alter ) {
275                       $has_filled{$pattern}->{$code},          push( @$tab, [ $pattern_uq,
276                           $has_filled{ $pattern_uq }->{ $code },
277                       $code,                       $code,
278                       $cgi->textfield(-name => "p:$pattern:$code", -size => 5, -value => $code, -override => 1)                         $self->{ 'cgi' }->textfield(-name => "p##:##$pattern##:##$code", -size => 5, -value => $code, -override => 1)
279                         ]);
280          }
281          else {
282            push( @$tab, [ $pattern_uq,
283                           $has_filled{ $pattern_uq }->{ $code },
284                           $code
285                     ]);                     ]);
286      }      }
287        }
288    
289      foreach $code ( @codes ) {      foreach $code ( @codes ) {
290          if ( $can_alter ) {
291        push( @$tab,[ $has_filled{ $pattern }->{ $code },          push( @$tab, [ $pattern_uq,
292                           $has_filled{ $pattern_uq }->{ $code },
293                      $code,                      $code,
294                      $cgi->textfield(-name => "p:$pattern:$code", -size => 5, -value => $code, -override => 1)                         $self->{ 'cgi' }->textfield( -name => "p##:##$pattern##:##$code", -size => 5, -value => $code, -override => 1)
295                    ]);                    ]);
296      }      }
297          else {
298            push( @$tab, [ $pattern_uq,
299                           $has_filled{ $pattern_uq }->{ $code },
300                           $code
301                         ]);
302          }
303        }
304    }    }
305    
306    $cont .= $frtable;    $cont .= $frtable;
   $cont .= $self->start_form();  
307    
308    # create table from parsed data    my $thistable = create_table( $self, \%has_filled, $col_hdrs, $tab );
309    my $table = $application->component( 'ShowVariantsTable' );  
310    $table->columns( $col_hdrs );    ############################################
311    $table->data( $tab );    # Variant Descriptions from the Notes file #
312      ############################################
313      $cont .= "<H2>Variant descriptions</H2>\n";
314      my $variants = $sub->get_variants();
315    
316      my $infotable = '';
317      if ( $can_alter ) {
318        $infotable .= "<TABLE class='table_table'><TR><TD class='table_first_row'>Variant</TD><TD class='table_first_row'>Description</TD></TR>";
319        foreach my $kv ( sort keys %$variants ) {
320          my $esc_kvd = $variants->{ $kv };
321          $esc_kvd =~ s/'/&#39;/g;
322          $infotable .= "<TR><TD class='table_odd_row'>";
323          $infotable .= $self->{ 'cgi' }->textfield( -name => "VARIANT", -id => "VARIANT", -size => 20, -value => $kv, -override => 1 );
324          $infotable .= "</TD><TD class='table_odd_row'>";
325          $infotable .= $self->{ 'cgi' }->textfield( -name => "VARIANTDESC", -id => "VARIANTDESC", -size => 70, -value => $variants->{ $kv }, -override => 1 );
326          $infotable .= "</TD></TR>";
327        }
328        $infotable .= "<TR><TD class='table_odd_row'>";
329        $infotable .= $self->{ 'cgi' }->textfield( -name => "NEWVARIANT", -id => "NEWVARIANT", -size => 20, -override => 1 );
330        $infotable .= "</TD><TD class='table_odd_row'>";
331        $infotable .= $self->{ 'cgi' }->textfield( -name => "NEWVARIANTDESC", -id => "NEWVARIANTDESC", -size => 70, -override => 1 );
332        $infotable .= "</TD></TR>";
333        $infotable .= "<TR><TD>";
334        $infotable .= $self->{ 'cgi' }->submit( -name => "addsave_variants", -value => "Add/Save Variants" );
335        $infotable .= "</TD></TR></TABLE>";
336    
337        $cont .= $infotable;
338      }
339      else {
340        my $infotable = $application->component( 'VarDescTable' );
341        $infotable->columns( [ { name => "Variant" }, { name => "Description" } ] );
342    
343        my $vardata;
344        foreach my $kv ( sort keys %$variants ) {
345          push @$vardata, [ $kv, $variants->{ $kv } ];
346        }
347        $infotable->data( $vardata );
348        $cont .= $infotable->output();
349      }
350    
351      my $esc_name = uri_escape($name);
352    
353    $cont .= "<H2>Variant groups</H2>\n";    $cont .= "<H2>Variant groups</H2>\n";
354    $cont .= $application->component( 'ShowVariantsTable' )->output();    $cont .= $thistable;
355    
356      $cont .= $self->{ 'cgi' }->hidden(-name => 'request', -value => 'set_variants', -override => 1);
357      $cont .= $self->{ 'cgi' }->hidden(-name => 'subsystem', -value => $name, -override => 1 );
358    
359      if ( defined( $self->{ 'cgi' }->param( 'hundred_hundred' ) ) ) {
360        $cont .= $self->{ 'cgi' }->hidden(-name => 'hundred_hundred', -value => $self->{ 'cgi' }->param( 'hundred_hundred' ), -override => 1 );
361      }
362    
363    $cont .= $cgi->hidden(-name => 'request', -value => 'set_variants', -override => 1);    if ( $can_alter ) {
364    $cont .= $cgi->hidden(-name => 'subsystem', -value => $name, -override => 1);      $cont .= $self->{ 'cgi' }->br;
365    $cont .= $cgi->br;    }
366    $cont .= $cgi->submit( -name => "set_variants", -value => "Set Variants" );    $cont .= $self->{ 'cgi' }->submit( -name => "set_variants", -value => "Set Variants" );
367    $cont .= $self->end_form();    $cont .= $self->end_form();
368    
369    return $cont;    return $cont;
# Line 196  Line 374 
374  # get a functional role table #  # get a functional role table #
375  ###############################  ###############################
376  sub format_roles {  sub format_roles {
377      my( $application, $fig, $cgi, $subsystem ) = @_;      my( $self, $subsystem ) = @_;
378      my( $i );      my( $i );
379    
380      my $col_hdrs = [ "Column", "Abbrev", "Functional Role" ];      my $col_hdrs = [ "Column", "Abbrev", "Functional Role" ];
381    
382      my $n = 1;      my ( $tab, $abbrevP ) = $self->format_existing_roles( $subsystem );
     my ( $tab, $abbrevP ) = format_existing_roles( $fig, $subsystem, \$n );  
383    
384      # create table from parsed data      # create table from parsed data
385      my $table = $application->component( 'FRTable' );      my $table = $self->application->component( 'FRTable' );
386      $table->columns( $col_hdrs );      $table->columns( $col_hdrs );
387      $table->data( $tab );      $table->data( $tab );
388    
389      my $formatted = '<H2>Functional Roles</H2>';      my $formatted = '<H2>Functional Roles</H2>';
390      $formatted .= $application->component( 'FRTable' )->output();      $formatted .= $self->application->component( 'FRTable' )->output();
391    
392      $formatted .= "<BR><BR>";      $formatted .= "<BR><BR>";
393      return ( $abbrevP, $formatted );      return ( $abbrevP, $formatted );
# Line 220  Line 397 
397  # get rows of the functional role table #  # get rows of the functional role table #
398  #########################################  #########################################
399  sub format_existing_roles {  sub format_existing_roles {
400      my ( $fig, $subsystem, $nP ) = @_;      my ( $self, $subsystem ) = @_;
401      my $tab = [];      my $tab = [];
402      my $abbrevP = {};      my $abbrevP = {};
403    
# Line 228  Line 405 
405        my $i = $subsystem->get_role_index( $role );        my $i = $subsystem->get_role_index( $role );
406        my $abbrev = $role ? $subsystem->get_role_abbr( $i ) : "";        my $abbrev = $role ? $subsystem->get_role_abbr( $i ) : "";
407        $abbrevP->{ $role } = $abbrev;        $abbrevP->{ $role } = $abbrev;
408        push( @$tab, [ $$nP, $abbrev, $role ] );        push( @$tab, [ $i + 1, $abbrev, $role ] );
409      }      }
410    
411      return ( $tab, $abbrevP );      return ( $tab, $abbrevP );
# Line 239  Line 416 
416  # change the variants in the subsystems file #  # change the variants in the subsystems file #
417  ##############################################  ##############################################
418  sub set_variants {  sub set_variants {
419      my ( $cgi, $fig, $subsys, $sub, $application, $datahash ) = @_;      my ( $self, $subsys, $sub, $application, $datahash ) = @_;
420    
421      my @genomes        = @{ $datahash->{ 'genomes' } };      my @genomes        = @{ $datahash->{ 'genomes' } };
422      my %variant_codes = %{ $datahash->{ 'varcodes' } };      my %variant_codes = %{ $datahash->{ 'varcodes' } };
423      my @roles          = @{ $datahash->{ 'roles' } };      my @roles          = @{ $datahash->{ 'roles' } };
424    
425      my ( $abbrev, $frtable ) = format_roles( $application, $fig, $cgi, $sub );      my ( $abbrev, $frtable ) = $self->format_roles( $sub );
426    
427      my ( %genomes_with );      my ( %genomes_with );
428      foreach my $genome ( @genomes ) {      foreach my $genome ( @genomes ) {
# Line 255  Line 432 
432        foreach my $role ( @roles ) {        foreach my $role ( @roles ) {
433          push( @has, ( $sub->get_pegs_from_cell( $genome, $role ) > 0 ) ? $abbrev->{ $role } : () );          push( @has, ( $sub->get_pegs_from_cell( $genome, $role ) > 0 ) ? $abbrev->{ $role } : () );
434        }        }
435        my $pattern = join( ",", @has );        my $pattern = quotemeta( join( ",", @has ) );
436        push( @{ $genomes_with{ "$pattern, $vc" } }, $genome );        push( @{ $genomes_with{ "$pattern, $vc" } }, $genome );
437      }      }
438    
439      my $comment = '';      my $comment = '';
440        my @params = grep { $_ =~ /^p##:##/ } $self->{ 'cgi' }->param;
441    
     my @params = grep { $_ =~ /^p:/ } $cgi->param;  
442      foreach my $param (@params) {      foreach my $param (@params) {
443        if ( $param =~ /^p:(.*):(.*)$/ ) {  
444          if ( $param =~ /^p##:##(.*)##:##(.*)$/ ) {
445          my ( $pattern, $vc ) = ( $1, $2 );          my ( $pattern, $vc ) = ( $1, $2 );
446    
447          $pattern =~ s/ //g;          $pattern =~ s/ //g;
448          $vc      =~ s/ //g;          $vc      =~ s/ //g;
449          my $to = $cgi->param( $param );          my $to = $self->{ 'cgi' }->param( $param );
450    
451          if ( my $x = $genomes_with{ "$pattern, $vc" } ) {          if ( my $x = $genomes_with{ "$pattern, $vc" } ) {
   
452            foreach my $genome ( @$x ) {            foreach my $genome ( @$x ) {
453    
454              if ( $to ne $variant_codes{ $genome } ) {              if ( $to ne $variant_codes{ $genome } ) {
455    
456                my $old = $variant_codes{$genome};                my $old = $variant_codes{$genome};
457                my $gs = $fig->genus_species($genome);                my $gs = $self->{ 'fig' }->genus_species( $genome );
458                $comment .= "resetting $genome $gs from $old to $to<BR>\n";                $comment .= "resetting $genome $gs from $old to $to<BR>\n";
459                $sub->set_variant_code( $sub->get_genome_index( $genome ), $to );                $sub->set_variant_code( $sub->get_genome_index( $genome ), $to );
460              }              }
461            }            }
   
462          }          }
463        }        }
464      }      }
465    
466        $sub->incr_version();
467        $sub->db_sync();
468      $sub->write_subsystem();      $sub->write_subsystem();
469    
470      return $comment;      return $comment;
471  }  }
472    
473    sub create_table {
474      my ( $self, $has_filled, $col_hdrs, $tab ) = @_;
475    
476      my $in;
477      my $tabl = "<TABLE class='table_table'><TR>";
478    
479      foreach my $ch ( @$col_hdrs ) {
480        $tabl .= "<TD class='table_first_row'>";
481        $tabl .= $ch->{ name };
482        $tabl .= "</TD>";
483      }
484    
485      foreach my $r ( @$tab ) {
486        $tabl .= "<TR>";
487    
488        my $num = scalar( keys %{ $has_filled->{ $r->[0] } } );
489        my $pat = $r->[0];
490        if ( $num > 1 ) {
491          if ( !$in->{ $pat } ) {
492            $tabl .= "<TD rowspan=$num class='table_odd_row' STYLE='vertical-align: middle;'>".$r->[0]."</TD>";
493            $in->{ $pat } = 1;
494          }
495        }
496        else {
497          $tabl .= "<TD class='table_odd_row'>".$r->[0]."</TD>";
498        }
499        my $next = 0;
500        foreach my $cell ( @$r ) {
501          if ( $next == 0 ) {
502            $next = 1;
503            next;
504          }
505          else {
506            $tabl .= "<TD class='table_odd_row'>".$cell."</TD>";
507          }
508        }
509        $tabl .= "</TR>";
510      }
511    
512      $tabl .= "</TABLE>";
513    
514      return $tabl;
515    }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.13

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3