[Bioperl-l] Help with BioGraphics

davila davila at ioc.fiocruz.br
Mon Nov 29 06:22:06 EST 2004


Hi,

We are using the "Parsing Real BLAST Output" (from HOWTOS) to build a panel that shows 6 frames and hits matching any frame. The problem being to parse and show results from different blast results (meaning: we have 4 different blast output files, all have the same queries but with different target databases) in a single 6-frame panel.

Our code and preliminary results are listed below... any tip/help would be greatly appreciated.

Thanks, 

Alberto

*******

Code:

#!/usr/bin/perl

# This is code example 4 in the Graphics-HOWTO
#use strict;
use lib "/usr/local/bioperl14";
use GD;
use Bio::Graphics;
use Bio::SearchIO;

$directory = $ARGV[0] or die;

chdir $directory;
chomp (@outs_blast = `ls`);

$panel_control = 0;
for (-3..+3) {
   $frame = "$_";
   $print_line_frame = 1;
   print "$frame\n";
 foreach $file (@outs_blast){

  $searchio = Bio::SearchIO->new(-file   => $file,
                                 -format => 'blast') or die "parse
failed";
         print "\n$file\n";
         while ( $result = $searchio->next_result ) {
                $query_name = $result->query_name;
                print "Open file a Imagem da $query_name na frame $frame
\n";
                open (PNG, ">>$query_name.png");
               
                if ($panel_control < 2 ){
                print "Make the Painel of $query_name\n";
                $panel = Bio::Graphics::Panel->new(-length  => $result-
>query_length,         
                                              -width     => 1000,
                                              -pad_left  => 10,
                                              -pad_right => 10,
                                             );
                }
                if ($print_line_frame == 1){
                print "Building line of frame $frame:\n";
                $full_length = Bio::SeqFeature::Generic->new(-start=>1,
                                                                -end=>
$result->query_length,
                                                                -
display_name=>$result->query_name."FRAME:$frame"
                                                                   );
                $panel->add_track($full_length,
                                    -glyph   => 'arrow',
                                    -tick    => 2,
                                    -fgcolor => 'black',
                                    -double  => 1,
                                    -label   => 1,
                                   );
               
                }                 
                print "Buscando query na frame $frame no resultado $file
\n";
               
                $track = $panel->add_track(-glyph       =>
'graded_segments',
                                      -label       => 1,
                                      -connector   => 'dashed',
                                      -bgcolor     => 'blue',
                                      -font2color  => 'red',
                                      -sort_order  => 'high_score',
                                      -description => sub  {
                                               $feature = shift;
                                               return unless $feature-
>has_tag('description');
                                               ($description) =
$feature->each_tag_value('description');
                                               $score = $feature->score;
                                              "$description, score=
$score";
                                                      }
                                      );
                $count =0;
                 while( $hit = $result->next_hit ) {
                   next unless $count < 1;
                   $feature_hit = Bio::SeqFeature::Generic->new(-score
=>
$hit->raw_score,
                                                            -
display_name
=> $hit->name,
                                                         -tag     => {
                                                         description =>
$hit->description
                                                                     }
                                                         );
                        while( $hsp = $hit->next_hsp ) {
                           $query_frame = ($hsp->query->frame + 1) *
$hsp->query-
>strand;       
                           $hit_frame = ($hsp->hit->frame + 1) * $hsp-
>hit->strand;
        
                           $feature_hit->add_sub_SeqFeature
($hsp,'EXPAND');
                           $count++;
                        }
                        if ($query_frame == $frame) {
                         $track->add_feature($feature_hit);
                        }
                 }
          print PNG $panel->png;
          $panel = "";
          close PNG;
        }
   $print_line_frame++;
   $panel_control++;
   }
}
this are part of the error:
Make the Painel of 335
Buscando query na frame -3 no resultado blast.db.repbase.out
gd-png:  fatal libpng error: Image width or height is zero in IHDR
gd-png error: setjmp returns error condition
Segmentation fault





More information about the Bioperl-l mailing list