Merge pull request #5269 from solgenomics/topic/sol_pan_genome
[sgn.git] / cgi-bin / maps / physical / view_fish.pl
blob496b5cb84f13c879de7ca99b1ec635bb0d837db0
1 use strict;
2 use warnings;
3 use CXGN::Page;
4 use CXGN::Fish;
5 use CXGN::DB::Connection;
6 use SGN::Image;
8 use CatalystX::GlobalContext '$c';
10 my $page = CXGN::Page->new("view_fish.pl","john,marty");
11 my ($image_size) = $page->get_encoded_arguments('size');
12 my ($clone_id) = $page->get_encoded_arguments('id');
13 my ($image_id) = $page->get_encoded_arguments('image_id');
15 # Argument validation.
16 unless ($clone_id && $image_id) {
17 $page->message_page ("This page requires two arguments, and at least one wasn't supplied.");
19 unless (($clone_id =~ /\d+/) && ($image_id =~ /\d+/)) {
20 $page->message_page ("Bogus page arguments supplied ($clone_id, $image_id)");
23 # Argument coercion.
24 unless ($image_size =~ /(full|small)/i) {
25 $image_size = 'small';
28 my $dbh = CXGN::DB::Connection->new;
29 # ensure that the image_id is a fish image
30 my $image;
31 if ($dbh->selectrow_array("select fish_result_id from fish_result_image where image_id = ?", undef, $image_id)) {
32 $image = SGN::Image->new( $dbh, $image_id, $c );
35 if ($image) {
36 my $fish_table = CXGN::Fish::fish_image_html_table($dbh, $clone_id);
37 my $image_url;
38 my $size_control;
39 if ($image_size =~ /full/i) {
40 $image_url = $image->get_image_url('large');
41 $size_control = "<b>Size:</b>&nbsp;&nbsp;&nbsp;
42 <a href=\"?id=$clone_id&amp;image_id=$image_id&amp;size=small\">Small</a>
43 &nbsp;&nbsp;&nbsp;Full"
44 } else {
45 $image_url = $image->get_image_url();
46 $size_control = "<b>Size:</b>&nbsp;&nbsp;&nbsp;Small&nbsp;&nbsp;&nbsp;
47 <a href=\"?id=$clone_id&amp;image_id=$image_id&amp;size=full\">Full</a>"
50 $page->header("View FISH image");
51 print <<EOHTML;
52 <a href="/maps/physical/clone_info.pl?id=$clone_id">Return to Clone info page</a>
53 <br />
54 <br />
55 $fish_table
56 <br />
57 $size_control
58 <br />
59 <br />
60 <a href="/image/index.pl?image_id=$image_id"><img src=\"$image_url\" /></a>
61 EOHTML
62 $page->footer();
63 } else {
64 $page->message_page("Clone image not found.");
66 #EOF