[Bioperl-l] Bio::Graphics - I am having trouble drawing protein
domain topology
Allen Liu
axl163 at yahoo.com
Fri Jun 18 08:15:46 EDT 2004
Hi Bioperl-users,
I am a bioperl newbie and I am having a hard time
trying to get Bio::Graphics to do what I need it to.
I have been attempting to write a script that would
read a file like the following:
>AAM43765 456 Bombesin 4.47E-03 307 316
>AAM43765 456 PROTEIN_KINASE_ATP 8.00E-05 134 167
>AAM43765 456 PROTEIN_KINASE_ST 8.00E-05 247 259
The first column is the name of my protein. The
second column is the length of the protein. The third
column is the name of the domain. The fourth column
is the e-value. The fifth and sixth columns are the
start and ends of the domain.
I have based my initial efforts on Lincoln Stein's
examples which works fine and I was able to get all my
domains on one track, but I could not get it to label
any other domains other than the first domain. Also,
I could not get the solid line that links the domains
to start from the beginning and go all the way to the
end of the protein.
This is the script I have so far:
#!/usr/bin/perl -w
use strict;
use Bio::Graphics;
use Bio::SeqFeature::Generic;
chomp (my $file = shift(@ARGV));
open(INPUT, "<$file") or die "Cannot open \"$file\":
$!\n";
my @data = <INPUT>;
close INPUT;
my $panel;
my $flag = 1;
my ($feature, $track);
foreach(@data) {
chomp;
next if /^\#/; # ignore comments
my ($name, $length, $domain, $score, $start, $end) =
split /\t+/;
if($flag == 1) {
# draw panel
$panel = Bio::Graphics::Panel->new(-length =>
$length,
-width => 800,
-pad_left => 10,
-pad_right => 10,
);
# draw reference ruler of size sequence
my $full_length =
Bio::SeqFeature::Generic->new(-start=>1,
-end=>$length);
$panel->add_track($full_length,
-glyph => 'arrow',
-tick => 2,
-fgcolor => 'black',
-double => 1,
-label => "$name",
);
$flag = 0;
$track = $panel -> add_track(-glyph => 'rndrect',
-label => 1,
-bgcolor => 'blue',
-min_score => 0,
-max_score => 1000,
-font2color => 'red',
-sort_order => 'high_score',
-description => sub {
my $feature = shift;
my $score = $feature->score;
if ($score =~ /E/) {
return "e-value=$score";
}
else {
return "score=$score";
}
});
$feature =
Bio::SeqFeature::Generic->new(-display_name=>$domain,
-score=>$score, -start=>$start, -end=>$end);
}
my $subfeature = Bio::SeqFeature::Generic->new(-label
=>$domain, -display_name=>$domain, -score=>$score,
-start=>$start, -end=>$end);
$feature->add_SeqFeature($subfeature, 'EXPAND');
}
$track -> add_feature($feature);
print $panel -> png;
exit;
Any help would be greatly appreciated.
Bioperl newbie
More information about the Bioperl-l
mailing list