Problem with Graphics

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with Graphics

Iain Wallace
Hi,

I am trying to use the Bio::Graphics module, but am unable to view my
output file. When I try to view the file I am told the file is
corrupt.

Below is the code that I tried and it seems to work (i.e. it doesn't
crash and generates an output file)

Unfortunately I have no idea what the error could be.
Any help/pointers would be greatly appreciated

Thanks

Iain
---- Code from the How To ---

#!/usr/bin/perl

    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  => 1);

    while (<>) { # read blast file
      chomp;
      next if /^\#/;  # ignore comments
     my($name,$score,$start,$end) = split /\t+/;
     my $feature =
Bio::SeqFeature::Generic->new(-display_name=>$name,-score=>$score,
                                                 -start=>$start,-end=>$end);
     $track->add_feature($feature);
   }

   print $panel->png;

_______________________________________________
Bioperl-l mailing list
[hidden email]
http://portal.open-bio.org/mailman/listinfo/bioperl-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Graphics

Jason Stajich
Are you on windows?

Try adding this before calling print.
binmode (STDOUT);

On Dec 14, 2005, at 10:59 AM, Iain Wallace wrote:

> Hi,
>
> I am trying to use the Bio::Graphics module, but am unable to view my
> output file. When I try to view the file I am told the file is
> corrupt.
>
> Below is the code that I tried and it seems to work (i.e. it doesn't
> crash and generates an output file)
>
> Unfortunately I have no idea what the error could be.
> Any help/pointers would be greatly appreciated
>
> Thanks
>
> Iain
> ---- Code from the How To ---
>
> #!/usr/bin/perl
>
>     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  => 1);
>
>     while (<>) { # read blast file
>       chomp;
>       next if /^\#/;  # ignore comments
>      my($name,$score,$start,$end) = split /\t+/;
>      my $feature =
> Bio::SeqFeature::Generic->new(-display_name=>$name,-score=>$score,
>                                                  -start=>$start,-
> end=>$end);
>      $track->add_feature($feature);
>    }
>
>    print $panel->png;
>
> _______________________________________________
> Bioperl-l mailing list
> [hidden email]
> http://portal.open-bio.org/mailman/listinfo/bioperl-l

--
Jason Stajich
Duke University
http://www.duke.edu/~jes12


_______________________________________________
Bioperl-l mailing list
[hidden email]
http://portal.open-bio.org/mailman/listinfo/bioperl-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Graphics

Iain Wallace
Thanks Jason,
That works for me even though I am on linux (not sure why, but it does)

Iain

On 12/14/05, Jason Stajich <[hidden email]> wrote:

> Are you on windows?
>
> Try adding this before calling print.
> binmode (STDOUT);
>
> On Dec 14, 2005, at 10:59 AM, Iain Wallace wrote:
>
> > Hi,
> >
> > I am trying to use the Bio::Graphics module, but am unable to view my
> > output file. When I try to view the file I am told the file is
> > corrupt.
> >
> > Below is the code that I tried and it seems to work (i.e. it doesn't
> > crash and generates an output file)
> >
> > Unfortunately I have no idea what the error could be.
> > Any help/pointers would be greatly appreciated
> >
> > Thanks
> >
> > Iain
> > ---- Code from the How To ---
> >
> > #!/usr/bin/perl
> >
> >     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  => 1);
> >
> >     while (<>) { # read blast file
> >       chomp;
> >       next if /^\#/;  # ignore comments
> >      my($name,$score,$start,$end) = split /\t+/;
> >      my $feature =
> > Bio::SeqFeature::Generic->new(-display_name=>$name,-score=>$score,
> >                                                  -start=>$start,-
> > end=>$end);
> >      $track->add_feature($feature);
> >    }
> >
> >    print $panel->png;
> >
> > _______________________________________________
> > Bioperl-l mailing list
> > [hidden email]
> > http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
> --
> Jason Stajich
> Duke University
> http://www.duke.edu/~jes12
>
>
>

_______________________________________________
Bioperl-l mailing list
[hidden email]
http://portal.open-bio.org/mailman/listinfo/bioperl-l