[Bioperl-l] Question

Jonathan Greenwood jegreenwood25 at hotmail.com
Mon Mar 1 10:28:13 EST 2004


Hi there, I made a png file with clickable glyphs, now instead of having the 
description of the feature underneath the glyph, I would like to make it 
appear as those pop-up boxes that appear when you place the cursor over the 
glyph. So far the code works but it only takes the first assigned value and 
ignores the rest(which is a problem if there is more than one of the same 
feature). Please help!!

Sincerely,

Jonathan Greenwood
email: jegreenwood25 at hotmail.com

Code:

#! /usr/local/bin/perl -w

use strict;
use Bio::Graphics;
use Bio::SeqIO;
use Bio::SeqFeature::Generic;
use CGI qw / :standard /;
use CGI::Pretty;

my $io = Bio::SeqIO->new(-file   => 'x65306.gb',
			 -format => 'Genbank');
my $seq = $io->next_seq;
my $wholeseq = Bio::SeqFeature::Generic->new(-start=>1,
					     -end=>$seq->length);
my @features = $seq->all_SeqFeatures;

# sort features by their primary tags
my %sorted_features;
for my $f (@features) {
  my $tag = $f->primary_tag;
  push @{$sorted_features{$tag}},$f;
}

my $panel = Bio::Graphics::Panel->new(-length       => $seq->length,
				      -width        => 1000,
				      -pad_left     => 10,
				      -pad_right    => 10,
				      -key_style    => 'none',
				      -spacing      => -0.25,
				      -box_subparts => 'true'
				      );

$panel->add_track($wholeseq,
		  -glyph  => 'arrow',
		  -bump   => +1,
		  -double => 1,
		  -tick   => 2
	          );

# special feature
if ($sorted_features{CDS}) {
  $panel->add_track($sorted_features{CDS},
		    -glyph          => 'transcript2',
		    -bgcolor        => 'orange',
		    -bump           =>  0,
		    -height         => 12,
		    -title          => cds_parsing(),
		    -link           => 
'http://mgcheo.med.uottawa.ca/cgi-bin/feature.pl#CDS/',
		    );
  delete $sorted_features{'CDS'};
}

# general case

my @colors = qw(wheat blue yellow green cyan purple chartreuse magenta 
gray);
my $idx    = 0;
for my $tag (sort keys %sorted_features) {
my $features = $sorted_features{$tag};
delete $sorted_features{source};
$panel->add_track($features,
		  -glyph        =>  'generic',
		  -bgcolor      =>  $colors[$idx++ % @colors],
		  -fgcolor      =>  'black',
		  -bump         => 0,
		  -height       => 12,
                  -title        => other_parsing(),
		  -link         => '/cgi-bin/feature.pl',
		 );
}

my ($url,$map,$mapname) = $panel->image_and_map(-url => 'tmpfiles');

print "Content-type: text/html\n\n";

print <<END_OF_SCRIPT;
<HTML>
<HEAD>
<H1 ALIGN="CENTER"> These links don't function in the way they are supposed 
to...</H1>
</HEAD>
<BODY>
<IMG SRC = "/$url" USEMAP = "#$mapname" ISMAP>
$map
</BODY>
</HTML>
END_OF_SCRIPT

exit 0;

sub cds_parsing {
my $seqio_object = Bio::SeqIO->new(-file => 'x65306.gb');
my $seq_object = $seqio_object->next_seq;

foreach my $feat_object ($seq_object->get_SeqFeatures) {
	  if ($feat_object->primary_tag eq "CDS") {
	    foreach my $val ($feat_object->get_tag_values('product')){
	      if ($feat_object->has_tag('product')) {
		return $val;
	      }
	    }
	  }
	}
}

sub other_parsing {
return "Still needs some work";
}

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



More information about the Bioperl-l mailing list