Merge pull request #5248 from solgenomics/topic/batch_update_trials
[sgn.git] / cgi-bin / maps / physical / clone_restriction_gel_image.pl
blob49702f7fb1b8d3eb075485ad65ea817b42b7dd33
1 use strict;
2 use warnings;
4 use Bio::Graphics::Gel;
6 use CXGN::Genomic::Clone;
8 use CXGN::Page;
10 my $page = CXGN::Page->new;
12 my ($clone_id,$enzyme,$fingerprint_id) = $page->get_encoded_arguments(qw/id enzyme fp_id/);
13 $fingerprint_id += 0; $clone_id += 0; #< enforce numericness
15 my $clone = CXGN::Genomic::Clone->retrieve($clone_id)
16 or die "could not retrieve clone with id '$clone_id'";
18 my $is_frags = $clone->in_silico_restriction_fragment_sizes($enzyme);
20 my ($iv_frags) = grep {$_->[0] == $fingerprint_id && $_->[1] eq $enzyme } $clone->in_vitro_restriction_fragment_sizes($enzyme);
22 if($iv_frags) {
23 shift @$iv_frags; shift @$iv_frags; #shift off the fingerprint id and enzyme name
26 $is_frags || $iv_frags
27 or die "no restriction fragments available at all for this clone. user should not have been directed here.";
29 #warn "drawing fragment\n";
30 my $gel = Bio::Graphics::Gel->new(
31 $iv_frags ? ('i.v.' => $iv_frags) : (),
32 $is_frags ? ('i.s.' => $is_frags) : (),
33 -min_frag => 1000,
34 -lane_length => 200,
35 -bandcolor => [0xff,0xc6,0x00],
38 print "Content-Type: image/png\n\n";
39 print $gel->img->png;