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

Annotation of /FigWebServices/ss_scoreboard.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download)

1 : olson 1.1 use FIG;
2 :     use CGI;
3 :     use HTML;
4 :    
5 :     use strict;
6 :    
7 :     my $cgi = new CGI;
8 :     my $fig = new FIG();
9 :    
10 : olson 1.3 my @subs = sort $fig->all_subsystems();
11 : olson 1.1
12 :     my %all_genomes;
13 :    
14 :     my $html = [];
15 :    
16 : olson 1.3 push(@$html, $cgi->start_form(-action => "ss_scoreboard.cgi",
17 :     -method => "post"));
18 :     #
19 :     # Show the selection list for limiting to family.
20 :     #
21 :    
22 :     my $taxonomic_groups = $fig->taxonomic_groups_of_complete(10);
23 :    
24 :     my @group_names = sort grep { $_ ne "All" } map { $_->[0] } @$taxonomic_groups;
25 :    
26 :     unshift(@group_names, "All");
27 :    
28 :     #
29 :     # Display in a scrolling list.
30 :     #
31 :    
32 :     push(@$html,
33 :     $cgi->h2("Limit genomes shown to group:"),
34 :     $cgi->scrolling_list(-name => 'limit_genome',
35 :     -values => [@group_names],
36 : olson 1.4 -default => "All",
37 : olson 1.3 -size => 5,
38 :     -multiple => 1),
39 :     );
40 :    
41 :    
42 :     #
43 :     # Determine if we're limiting genomes, and only use
44 :     # genomes from that group if we are.
45 :     #
46 :    
47 :     my @limit_genome = $cgi->param("limit_genome");
48 :     my %desired_genomes;
49 :    
50 :     if (grep({$_ eq "All"} @limit_genome))
51 :     {
52 :     @limit_genome = ();
53 :     }
54 :    
55 :     if (@limit_genome)
56 :     {
57 :     for my $limit_genome (@limit_genome)
58 :     {
59 :     my @list = grep({ $_->[0] eq $limit_genome } @$taxonomic_groups);
60 :     for my $litem (@list)
61 :     {
62 :     grep({ $desired_genomes{$_}++ } @{$litem->[1]});
63 :     }
64 :     }
65 :     }
66 :    
67 : olson 1.1 for my $subname (@subs)
68 :     {
69 :     my $sub = $fig->get_subsystem($subname);
70 :     my @subg = $sub->get_genomes();
71 : olson 1.3 for my $g (@subg)
72 :     {
73 :     next if @limit_genome and !$desired_genomes{$g};
74 :     $all_genomes{$g}++;
75 :     }
76 : olson 1.1 }
77 :    
78 : olson 1.3 #
79 :     # Now display the list of subsystems. We'll do this in a table for now; it
80 :     # may take up a lot of space, but I think picking multiple subsystems from
81 :     # a dropdown might be clumsy.
82 :     #
83 :     # Hm. Maybe we'll do a dropdown first and see how it works...
84 :     #
85 :    
86 :     my $list_size = @subs + 1;
87 :     $list_size = 10 if $list_size > 10;
88 :    
89 :     push(@$html,
90 :     $cgi->h2("Limit subsystems shown to ..."),
91 :     $cgi->scrolling_list(-name => 'limit_subsystem',
92 : olson 1.4 -default => "All",
93 : olson 1.3 -values => ["All", @subs],
94 :     -size => $list_size,
95 :     -multiple => 1));
96 :    
97 :     my @display_subs = $cgi->param("limit_subsystem");
98 :    
99 : olson 1.4 if (!@display_subs or grep({ $_ eq "All"} @display_subs))
100 : olson 1.3 {
101 :     @display_subs = @subs;
102 :     }
103 :    
104 :     push(@$html,
105 :     $cgi->p,
106 :     $cgi->submit(-label => "Update scoreboard",
107 :     -name => 'update_button'));
108 :    
109 :     #
110 :     # And show the table.
111 :     #
112 :     push(@$html, $cgi->hr, $cgi->h2("Scoreboard"));
113 :    
114 :     my @col_hdrs = map { s/_/ /g; $_ } @display_subs;
115 :     unshift(@col_hdrs, "Genome");
116 : olson 1.1
117 :     my @table;
118 :    
119 :     for my $k (keys(%all_genomes))
120 :     {
121 :     my $c = $all_genomes{$k};
122 :    
123 :     my $row = [];
124 :    
125 :     push(@$row, $k);
126 :    
127 : olson 1.3 for my $subname (@display_subs)
128 : olson 1.1 {
129 :     my $sub = $fig->get_subsystem($subname);
130 :     my $vc = $sub->get_variant_code_for_genome($k);
131 :     push(@$row, "\@align=\"center\":$vc");
132 :     }
133 :     push(@table, $row);
134 :     }
135 :    
136 :    
137 :     push(@$html, HTML::make_table(\@col_hdrs, \@table));
138 :    
139 : olson 1.3 push(@$html, $cgi->end_form());
140 :    
141 : olson 1.1 &HTML::show_page($cgi, $html);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3