[Bioperl-l] Can't add track to Panel Bio::Graphics
Emmanuel Quevillon
tuco at pasteur.fr
Mon Aug 31 10:13:41 EDT 2009
Hi,
I'm trying to create png image using Bio::Graphics.
I followed the Howto available at bioperl.org.
I'm stacked when trying to add new track to my panel. So far, I can
create the panel, add 2 tracks, then, probably mistaking, I can add
more tracks to my panel. Here is the code.
my $panel = Bio::Graphics::Panel->new(
-length => $self->seq()->length(),
-width => 800,
-pad_top => 5,
-pad_bottom => 5,
-pad_left => 5,
-pad_right => 5,
#-key_style => 'between',
);
my $bsg = Bio::SeqFeature::Generic->new(
-start => 1,
-seq => $self->seq()->seq(),
-end => $self->seq()->length(),
-display_name => $self->seq()->id(). "
(".$self->seq->length()." na)",
);
$bsg->attach_seq($self->seq());
#Display the reference sequence
############
#### Those 2 tracks are well displayed on the final image
###########
$panel->add_track($bsg, -glyph => 'dna', -label => 1);
$panel->add_track($bsg, -glyph => 'arrow', -tick => 2, -fgcolor
=> 'black');
#Build, if present, the single cut
if(keys %$spositions){
#Create the specail track for the single cut
my $strack = $panel->add_track(
-glyph => 'crossbox',
-label => 1,
-fgcolor => 'red',
-key => 'Single cut',
-connector => 'dashed',
);
foreach my $enz (sort { $a cmp $b } keys
%{$spositions->{$strand}}){
my $bsfg = Bio::SeqFeature::Generic->new(
-display_name => $enz,
-start =>
$spositions->{$strand}->{$enz}->{$enz}->start(),
-end =>
$spositions->{$strand}->{$enz}->{$enz}->start());
my $bsfg2 = Bio::SeqFeature::Generic->new(
-display_name => $enz,
-start =>
$spositions->{$strand}->{$enz}->{$enz}->end(),
-end =>
$spositions->{$strand}->{$enz}->{$enz}->end());
$strack->add_feature($bsfg);
$strack->add_feature($bsfg2);
}
}
#Build, if present, the double cut
if(keys %$dpositions){
my $dtrack = $panel->add_track(
-glyph => 'crossbox',
-label => 1,
-key => 'Double cut',
-connector => 'dashed',
);
foreach my $couple (sort { $a cmp $b } keys
%{$dpositions->{$strand}}){
foreach my $cc_enz (sort { $a cmp $b } keys
%{$dpositions->{$strand}->{$couple}}){
my $bsfg = Bio::SeqFeature::Generic->new(
-display_name => $couple,
-start =>
$dpositions->{$strand}->{$couple}->{$cc_enz}->start(),
-end =>
$dpositions->{$strand}->{$couple}->{$cc_enz}->start());
my $bsfg2 = Bio::SeqFeature::Generic->new(
-display_name => $cc_enz,
-start =>
$dpositions->{$strand}->{$couple}->{$cc_enz}->end(),
-end =>
$dpositions->{$strand}->{$couple}->{$cc_enz}->end());
$dtrack->add_feature($bsfg);
$dtrack->add_feature($bsfg2);
}
}
}
print $panel->png();
Can somebody tell me what I'm missing or doing wrong?
Thanks for any help
Regards
Emmanuel
--
-------------------------
Emmanuel Quevillon
Biological Software and Databases Group
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-------------------------
More information about the Bioperl-l
mailing list