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
::MapOverviews
::ProjectStats
;
29 use base
"CXGN::Cview::MapOverviews";
31 use CXGN
::Cview
::Map
::SGN
::ProjectStats
;
32 use CXGN
::People
::BACStatusLog
;
35 =head2 constructor new()
49 my $map = CXGN
::Cview
::Map
::SGN
::ProjectStats
->new($args->{dbh
});
51 my $self = $class->SUPER::new
($map, $args);
52 $self->{dbh
}= $args->{dbh
};
53 $self->set_horizontal_spacing(50);
54 $self->set_image_width(586);
55 $self->set_image_height(160);
56 $self->set_chr_height(80);
57 $self->{basepath
}=$args->{basepath
};
58 $self->{tempfiles_subdir
} = $args->{tempfiles_subdir
};
59 # print STDERR "Generating new map object...\n";
64 =head2 function generate_image()
79 =head2 function send_image()
91 print "Content-Type: image/png\n\n";
92 return $self->{map_image
}->render_png();
95 =head2 function render_map()
108 $self->get_cache()->set_key("project stats overview graph");
109 $self->get_cache()->set_force(1);
110 $self->get_cache()->set_expiration_time(40000); # set expiration time of cache to half a day.
111 $self->get_cache()->set_map_name("overview_map");
113 if ($self->get_cache()->is_valid()) { return; }
115 my $bac_status_log=CXGN
::People
::BACStatusLog
->new($self->{dbh
});
117 # print STDERR "WIDTH=".$self->get_image_width()." HEIGHT ".$self->get_image_height()."\n";
118 $self->{map_image
}=CXGN
::Cview
::MapImage
->new("", $self->get_image_width(), $self->get_image_height());
120 my @c_len = $bac_status_log->get_chromosome_graph_lengths();
121 my @bacs_to_complete = $bac_status_log->get_number_bacs_to_complete();
122 my @c_percent_finished = $bac_status_log->get_chromosomes_percent_finished();
124 my @bacs_in_progress = $bac_status_log->get_number_bacs_in_progress();
125 my @bacs_submitted = $bac_status_log->get_number_bacs_uploaded();
127 my @bacs_phase = $bac_status_log->get_number_bacs_in_phase(3);
131 $c[$i]= CXGN
::Cview
::Chromosome
::Glyph
-> new
(1, 100, $self->get_horizontal_spacing()*($i-1)+17, 25);
132 my $m = CXGN
::Cview
::Marker
->new($c[$i],0,0,0,0,0,0,$c_len[$i]);
134 $c[$i]->add_marker($m);
135 $c[$i]->set_caption($i);
136 $c[$i]->set_height($self->get_chr_height());
137 $c[$i]->set_url("/cview/view_chromosome.pl?map_version_id=agp&show_offsets=1&show_ruler=1&chr_nr=$i");
139 my $percent_in_progress = $bacs_in_progress[$i]/$bacs_to_complete[$i]*100;
141 my $percent_finished = $c_percent_finished[$i];
143 my $percent_htgs3 = $bacs_phase[$i]/$bacs_to_complete[$i]*100;
145 my $percent_available = $bacs_submitted[$i]/$bacs_to_complete[$i]*100;
147 #$percent_submitted = $percent_submitted - $percent_htgs3;
149 my $percent_in_progress_base_level = List
::Util
::max
($percent_finished, $percent_htgs3, $percent_available);
151 $percent_in_progress += $percent_in_progress_base_level;
153 #print STDERR "Chromosome $i $percent_htgs3, $percent_available, $percent_finished, $percent_in_progress\n";
156 $c[$i]->set_fill_level(0, $percent_htgs3);
157 $c[$i]->set_fill_level(1, $percent_available);
158 $c[$i]->set_fill_level(2, $percent_finished);
159 $c[$i]->set_fill_level(3, $percent_in_progress);
160 $c[$i]->set_bac_count(0);
161 $self->{map_image
}->add_chromosome($c[$i]);
163 my $white = $self->{map_image
}->get_image()->colorResolve(255,255,255);
164 $self->{map_image
}->get_image()->transparent($white);
168 $self->get_cache()->set_image_data( $self->{map_image
}->render_png_string());
169 $self->get_cache()->set_image_map_data ($self->{map_image
}->get_image_map("overview_map") );
173 =head2 function create_mini_overview()
178 Side effects: creates the mini overview png image that goes on the
184 sub create_mini_overview
{
186 $self->set_image_width(400);
187 $self->set_image_height(100);
188 $self->set_chr_height(50);
189 $self->set_horizontal_spacing(30);
191 my $url = "/documents/tempfiles/frontpage/project_stats_overview.png";
192 my $path = File
::Spec
->catfile($self->{basepath
}, $url);
195 $self->get_file_png($path);