[Bioperl-l] Bio::Graphics

Lincoln Stein lstein at cshl.edu
Tue Sep 9 16:10:48 EDT 2003


I'm sorry for doubting.  This seems to be a bug in Bio::SeqFeature::Generic in 
the released bioperl 1.2.2.  Enclosed is a patch file to fix it, and this 
will be included in next week's 1.2.3.  Alternatively you can do one of the 
following:

1)  In all examples, replace "Bio::SeqFeature::Generic" with 
"Bio::Graphics::Feature".  The latter is a plug-in replacement for 
Bio::SeqFeature::Generic but doesn't have the aforementioned bug.

alternatively 

2) After creating the Bio::SeqFeature::Generic, call its display_name() method 
to set the name:

	  my $feature = 
Bio::Graphics::Feature->new(-display_name=>$name,-score=>$score,
                                                 -start=>$start,-end=>$end);
	$feature->display_name($name);

Lincoln
	

On Tuesday 09 September 2003 10:10 am, Laurence Amilhat wrote:
> Sorry I am a little confused,
>
> The updated tutorial is the 2003-05-15 one? Is the one I am looking at.
> I tried the example and it still doesn't work.
>
> Scott cain gave me another example to make the same thing, and skip the
> problem, see below.
> (From his point of view your example will work on bioperl 1.3)
>
> Sincerely,
>
> Laurence
>
>
> #!/usr/local/bin/perl -w
> use strict;
> use Bio::Graphics;
> use Bio::SeqFeature::Generic;
>
> my $panel= Bio::Graphics::Panel->new(-length =>1000,-width =>800);
> my $track=$panel->add_track(-glyph =>'generic',
>                                  -label => sub{my $self=shift;
>                                          return $self->seq_id;},
>                                  -description=> sub{my $self=shift;
>                                          return $self->score;},
>                                  -bgcolor => sub{my $self=shift;
>                                          my $score = $self->score;
>                                          if ($score >= 1000) {
>                                          return 'red';
>                                          } else {
>                                          return 'green';
>                                          }
>                                          });
> while (<DATA>)
> {
>          chomp;
>          next if /^\#/;
>          my ($name,$score,$start,$end)=split /\s+/;
>          my $feature=Bio::SeqFeature::Generic->new(-seq_id=>$name,
>                                                        -score=>$score,
>                                                        -start=>$start,
>                                                        -end=>$end);
>          $track->add_feature($feature);
> }
> print $panel->png;
>
> At 11:39 29/08/2003 -0400, you wrote:
> >Sorry for responding so late to this e-mail.  You were looking at an out
> > of date tutorial that no longer matches the code base.  However, the
> > tutorial has now been updated and the examples should work.
> >
> >Lincoln
> >
> >On Wednesday 06 August 2003 03:09 am, Laurence Amilhat wrote:
> > > Hi,
> > >
> > > I try to learn how to use the module Bio::Graphics.
> > > I found he How To from Lincoln Stein on the web. I try to practice with
> > > the examples, it's working except for the labels of the features that
> > > don't appear on my figure.
> > > Does anybody ever use this module?
> > >
> > > This is the example:
> > > #!/usr/local/public/bin/perl
> > >
> > > use strict;
> > > use lib
> > > '/homej/bioinf/lamilhat/PERL_MODULE/lib/perl5/site_perl/5.005/BIOPERL/l
> > >ib/s ite_perl/5.6.1/'; use Bio::Graphics;
> > > use Bio::SeqFeature::Generic;
> > >
> > > my $panel= Bio::Graphics::Panel->new(-length =>1000,-width =>800);
> > > my $track=$panel->add_track(-glyph =>'generic',-label =>1);
> > >
> > >
> > > while (<>)
> > > {
> > >          chomp;
> > >          next if /^\#/;
> > >          my ($name,$score,$start,$end)=split /\t+/;
> > >          print STDERR "$name\n";
> > >          my $feature=
> > > Bio::SeqFeature::Generic->new(-display_name=>$name,-score=>$score,-star
> > >t=>$ start,-end=>$end); $track->add_feature($feature);
> > > }
> > >
> > > print $panel->png;
> > >
> > >
> > > And this is the Data to parse with the example:
> > > #hit    score   start   end
> > > truc1   381     2       200
> > > truc2   210     2       210
> > > truc3   800     2       200
> > > truc4   1000    380     921
> > > truc5   812     402     972
> > > truc6   1200    400     970
> > > bum     400     300     620
> > > pres1   127     310     700
> > >
> > >
> > > Thanks,
> > >
> > > Laurence.
> > >
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > INRA, UMR INRA/UBP Amélioration et Santé des Plantes
> > > 234 avenue du Brézet
> > > 63039 Clermont-Ferrand Cedex 2
> > >
> > > Tel 04 73 62 48 37
> > > Fax 04 73 62 44 53
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> >--
> >========================================================================
> >Lincoln D. Stein                           Cold Spring Harbor Laboratory
> >lstein at cshl.org                                   Cold Spring Harbor, NY
> >========================================================================
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> INRA, UMR INRA/UBP Amélioration et Santé des Plantes
> 234 avenue du Brézet
> 63039 Clermont-Ferrand Cedex 2
>
> Tel 04 73 62 40 87
> Fax 04 73 62 44 53
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- 
Lincoln Stein
lstein at cshl.edu
Cold Spring Harbor Laboratory
1 Bungtown Road
Cold Spring Harbor, NY 11724
(516) 367-8380 (voice)
(516) 367-8389 (fax)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: generic_diff.pm
Type: text/x-perl
Size: 1608 bytes
Desc: not available
Url : http://portal.open-bio.org/pipermail/bioperl-l/attachments/20030909/aa033cae/generic_diff.bin


More information about the Bioperl-l mailing list