5 CXGN::Cview::Map_overviews::ProjectStats - a class to display the tomato genome sequence project status.
9 see L<CXGN::Cview::Map_overviews>.
13 This class implements the project status overview graph found on the SGN homepage and the /about/tomato_sequencing.pl page, where each chromosome is represented by a glyph that is filled to the fraction of the estimated number of BACs needed to complete the chromosome sequence.
17 Lukas Mueller (lam87@cornell.edu)
21 This class implements the following functions:
27 package CXGN
::Cview
::Map_overviews
::ProjectStats
;
29 use CXGN
::Cview
::Map_overviews
;
30 use CXGN
::Cview
::Map
::SGN
::ProjectStats
;
31 use CXGN
::People
::BACStatusLog
;
35 use base
qw( CXGN::Cview::Map_overviews );
37 =head2 constructor new()
51 my $self = $class->SUPER::new
($force);
53 $self->set_horizontal_spacing(50);
54 $self->set_image_width(586);
55 $self->set_image_height(160);
56 $self->set_chr_height(80);
58 # print STDERR "Generating new map object...\n";
59 $self->set_map(CXGN
::Cview
::Map
::SGN
::ProjectStats
->new($self));
63 =head2 function generate_image()
78 =head2 function send_image()
90 print "Content-Type: image/png\n\n";
91 return $self->{map_image
}->render_png();
94 =head2 function render_map()
107 $self->get_cache()->set_key("project stats overview graph");
108 $self->get_cache()->set_force(1);
109 $self->get_cache()->set_expiration_time(40000); # set expiration time of cache to half a day.
110 $self->get_cache()->set_map_name("overview_map");
112 if ($self->get_cache()->is_valid()) { return; }
114 my $bac_status_log=CXGN
::People
::BACStatusLog
->new($self);
116 # print STDERR "WIDTH=".$self->get_image_width()." HEIGHT ".$self->get_image_height()."\n";
117 $self->{map_image
}=CXGN
::Cview
::MapImage
->new("", $self->get_image_width(), $self->get_image_height());
119 my @c_len = $bac_status_log->get_chromosome_graph_lengths();
120 my @bacs_to_complete = $bac_status_log->get_number_bacs_to_complete();
121 my @c_percent_finished = $bac_status_log->get_chromosomes_percent_finished();
123 my @bacs_in_progress = $bac_status_log->get_number_bacs_in_progress();
124 my @bacs_submitted = $bac_status_log->get_number_bacs_uploaded();
126 my @bacs_phase = $bac_status_log->get_number_bacs_in_phase(3);
130 $c[$i]= CXGN
::Cview
::Chromosome
::Glyph
-> new
(1, 100, $self->get_horizontal_spacing()*($i-1)+17, 25);
131 my $m = CXGN
::Cview
::Marker
->new($c[$i],0,0,0,0,0,0,$c_len[$i]);
133 $c[$i]->add_marker($m);
134 $c[$i]->set_caption($i);
135 $c[$i]->set_height($self->get_chr_height());
136 $c[$i]->set_url("/cview/view_chromosome.pl?map_version_id=agp&show_offsets=1&show_ruler=1&chr_nr=$i");
138 my $percent_in_progress = $bacs_in_progress[$i]/$bacs_to_complete[$i]*100;
140 my $percent_finished = $c_percent_finished[$i];
142 my $percent_htgs3 = $bacs_phase[$i]/$bacs_to_complete[$i]*100;
144 my $percent_available = $bacs_submitted[$i]/$bacs_to_complete[$i]*100;
146 #$percent_submitted = $percent_submitted - $percent_htgs3;
148 my $percent_in_progress_base_level = List
::Util
::max
($percent_finished, $percent_htgs3, $percent_available);
150 $percent_in_progress += $percent_in_progress_base_level;
152 #print STDERR "Chromosome $i $percent_htgs3, $percent_available, $percent_finished, $percent_in_progress\n";
155 $c[$i]->set_fill_level(0, $percent_htgs3);
156 $c[$i]->set_fill_level(1, $percent_available);
157 $c[$i]->set_fill_level(2, $percent_finished);
158 $c[$i]->set_fill_level(3, $percent_in_progress);
159 $c[$i]->set_bac_count(0);
160 $self->{map_image
}->add_chromosome($c[$i]);
162 my $white = $self->{map_image
}->get_image()->colorResolve(255,255,255);
163 $self->{map_image
}->get_image()->transparent($white);
167 $self->get_cache()->set_image_data( $self->{map_image
}->render_png_string());
168 $self->get_cache()->set_image_map_data ($self->{map_image
}->get_image_map("overview_map") );
172 =head2 function create_mini_overview()
177 Side effects: creates the mini overview png image that goes on the
183 sub create_mini_overview
{
185 $self->set_image_width(400);
186 $self->set_image_height(100);
187 $self->set_chr_height(50);
188 $self->set_horizontal_spacing(30);
190 my $url = "/documents/tempfiles/frontpage/project_stats_overview.png";
191 my $path = File
::Spec
->catfile($self->get_vhost()->get_conf("basepath"), $url);
194 $self->get_file_png($path);
199 =head2 DEPRECATED CLASS CXGN::Cview::Map_overviews::project_stats
205 Description: This class is deprecated. It now inherits from
206 CXGN::Cview::Map_overviews::ProjectStats
207 Use CXGN::Cview::Map_overview::ProjectStats
215 package CXGN
::Cview
::Map_overviews
::project_stats
;
217 use base qw
| CXGN
::Cview
::Map_overviews
::ProjectStats
|;
221 my $self = $class->SUPER::new
(@_);