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

Diff of /FigWebServices/diagram.cgi

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

revision 1.6, Fri Mar 9 20:11:48 2007 UTC revision 1.7, Fri Mar 23 18:29:33 2007 UTC
# Line 119  Line 119 
119      # find out about sort order      # find out about sort order
120      my $sort_by = $cgi->param('sort_by') || 'name';      my $sort_by = $cgi->param('sort_by') || 'name';
121    
122      # get the genomes from the subsystem with zero or positive variant codes      # get the genomes from the subsystem
123      my @genomes;      my @genomes;
124      my $genome = $cgi->param('genome_id');      my $genome = $cgi->param('genome_id');
125      if ($sort_by eq 'variant_code') {      if ($sort_by eq 'variant_code') {
126          foreach (sort { ($subsystem->get_variant_code( $subsystem->get_genome_index($a) ) cmp          @genomes = sort { ($subsystem->get_variant_code( $subsystem->get_genome_index($a) ) cmp
127                           $subsystem->get_variant_code( $subsystem->get_genome_index($b) )) or                           $subsystem->get_variant_code( $subsystem->get_genome_index($b) )) or
128                           ( $fig->genus_species($a) cmp $fig->genus_species($b) )                           ( $fig->genus_species($a) cmp $fig->genus_species($b) )
129                   } $subsystem->get_genomes()) {                          } $subsystem->get_genomes()
             my $vcode = $subsystem->get_variant_code( $subsystem->get_genome_index( $_ ) );  
             push @genomes, $_ if ($vcode >= 0);  
         }  
130      }      }
131      else {      else {
132          foreach (sort { $fig->genus_species($a) cmp $fig->genus_species($b) } $subsystem->get_genomes()) {          @genomes = sort { $fig->genus_species($a) cmp $fig->genus_species($b) } $subsystem->get_genomes();
133        }
134    
135        # show only genomes with zero or positive variant codes
136        # unless user switched that off
137        unless ($cgi->param('show_negative')) {
138            my @temp;
139            foreach (@genomes) {
140              my $vcode = $subsystem->get_variant_code( $subsystem->get_genome_index( $_ ) );              my $vcode = $subsystem->get_variant_code( $subsystem->get_genome_index( $_ ) );
141              push @genomes, $_ if ($vcode >= 0);              push @temp, $_ if ($vcode >= 0);
142          }          }
143            @genomes = @temp;
144      }      }
145    
146      my %genome_labels = map { $_ => $fig->genus_species($_)." ( $_ ) [".      my %genome_labels = map { $_ => $fig->genus_species($_)." ( $_ ) [".
# Line 157  Line 162 
162                                -value => $diagram_id );                                -value => $diagram_id );
163      $content .= $cgi->hidden( -name  => 'dont_scale', -value => 1 )      $content .= $cgi->hidden( -name  => 'dont_scale', -value => 1 )
164          if ($cgi->param('dont_scale'));          if ($cgi->param('dont_scale'));
165        $content .= $cgi->hidden( -name  => 'show_negative', -value => 1 )
166            if ($cgi->param('show_negative'));
167      $content .= $cgi->hidden( -name  => 'debug', -value => 1 )      $content .= $cgi->hidden( -name  => 'debug', -value => 1 )
168          if ($cgi->param('debug'));          if ($cgi->param('debug'));
169      $content .= '<p>Sort by: '.      $content .= '<p>Sort by: '.
# Line 166  Line 173 
173                             -labels  => { 'name' => 'Genome name',                             -labels  => { 'name' => 'Genome name',
174                                           'variant_code' => 'Variant code, then genome name' },                                           'variant_code' => 'Variant code, then genome name' },
175                             -onChange => 'document.getElementById("diagram_select_genome").submit();',                             -onChange => 'document.getElementById("diagram_select_genome").submit();',
176            ).' &nbsp; | &nbsp; ';
177        $content .= ''.$cgi->checkbox( -name  => 'show_negative',
178                                           -value => 1,
179                                           -label => 'Show genomes with negative variant codes',
180                                           -onChange => 'document.getElementById("diagram_select_genome").submit();',
181          ).'</p>';          ).'</p>';
182      $content .= $cgi->popup_menu( -name    => 'genome_id',      $content .= $cgi->popup_menu( -name    => 'genome_id',
183                                    -values  => \@genomes,                                    -values  => \@genomes,
# Line 338  Line 350 
350      my $scale = $d->calculate_scale * 100;      my $scale = $d->calculate_scale * 100;
351      unless ($scale == 100) {      unless ($scale == 100) {
352          $content .= '<p><em>This diagram has been scaled to '.sprintf("%.2f", $scale).'%. ';          $content .= '<p><em>This diagram has been scaled to '.sprintf("%.2f", $scale).'%. ';
353          $content .= "(<a href='?subsystem_name=$subsystem_name&diagram_id=$diagram_id&dont_scale=1'>".          $content .= "(<a href='?subsystem_name=$subsystem_name&diagram=$diagram_id&dont_scale=1'>".
354              "view in original size</a>)";              "view in original size</a>)";
355          $content .= '</em></p>';          $content .= '</em></p>';
356      }      }
357      if ($cgi->param('dont_scale')) {      if ($cgi->param('dont_scale')) {
358          $content .= '<p><em>You have switched off scaling this diagram down. ';          $content .= '<p><em>You have switched off scaling this diagram down. ';
359          $content .= "(<a href='?subsystem_name=$subsystem_name&diagram_id=$diagram_id'>".          $content .= "(<a href='?subsystem_name=$subsystem_name&diagram=$diagram_id'>".
360              "Allow scaling</a>)";              "Allow scaling</a>)";
361          $content .= '</em></p>';          $content .= '</em></p>';
362      }      }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3