[Bioperl-l] Parsing Blast Output

Wiepert, Mathieu Wiepert.Mathieu@mayo.edu
Tue, 11 Jun 2002 08:45:31 -0500


I forgot to answer the part about alignments.  I didn't find a method
$hsp->get_aln().  To get the alignments, the docs from
http://docs.bioperl.org/releases/bioperl-1.0/Bio/Tools/BPlite.html mention
that you can get alignment info from queryseq, sbjctseq, and homologyseq.
Add this to your code...

print "querySeq is ", $hsp->querySeq, "\n";
print "sbjctSeq is ", $hsp->sbjctSeq, "\n";
print "homologySeq is ", $hsp->homologySeq, "\n";

after you get the score.  You can remove the aln lines.  I hope that gets
you what you need?

-Mat


Mathieu Wiepert
Medical Information Resources
Mayo Foundation
(507) 266-2317 Fax (507)-284-0360
wiepert.mathieu@mayo.edu 


-----Original Message-----
From: AUnderwood@PHLS.org.uk [mailto:AUnderwood@PHLS.org.uk]
Sent: Tuesday, June 11, 2002 6:59 AM
To: Bioperl-l@bioperl.org
Subject: [Bioperl-l] Parsing Blast Output


Please can someone help me a Bioperl:Newbie out. I have written some code
adapted from the very helpful tutorials at the pasteur institue which will
remote blast a fasta file and then parse the output to display the hit name,
score and then the alignment in fasta format,

When I run this script I get the error message
MSG: Attribute id not set
STACK Bio::LocatableSeq::get_nse
/usr/lib/perl5/site_perl/5.6.1/Bio/LocatableSeq.pm:203
STACK Bio::AlignIO::fasta::write_aln
/usr/lib/perl5/site_perl/5.6.1/Bio/AlignIO/fasta.pm:175
STACK Bio::AlignIO::PRINT /usr/lib/perl5/site_perl/5.6.1/Bio/AlignIO.pm:469
STACK toplevel test_blast.pl:47

Please can someone  help me to understand what this message means. Also does
anybody know what method is available to print the alignment in the same
format as blast output from NCBI?

Many thanks if anybody can help.
I have tried many things all to no avail.


Thanks,   Anthony  



 use Bio::AlignIO;
  use Bio::SearchIO;
  use Bio::SimpleAlign;
  #use strict;
  my $v = 1;
  my $prog = 'blastn';
  my $db   = 'nr';
  my $e_val= '1e-10';

  my @params = ( '-prog' => $prog,
             '-data' => $db,
                 '-expect' => $e_val );

  my $factory = Bio::Tools::Run::RemoteBlast->new(@params);
  $v = 1;
  my $str = Bio::SeqIO->new(-file=>'/root/blastn/MC58.gbk.seq.00001' ,
'-format' => 'fasta' );
  my $input = $str->next_seq();
  #  Blast a sequence against a database:
  my $r = $factory->submit_blast($input);
  print STDERR "waiting..." if( $v > 0 );
  while ( my @rids = $factory->each_rid ) {
      foreach my $rid ( @rids ) {
          my $rc = $factory->retrieve_blast($rid);
        if( !ref($rc) ) {
           if( $rc < 0 ) {
$factory->remove_rid($rid);
                 }
           print STDERR "." if ( $v > 0 );
         sleep 5;
            } else {            $factory->remove_rid($rid);
             my $result = $rc->next_result;
          print "db is ", $result->database_name(), "\n";
         my $count = 0;
	
          while( my $hit = $result->next_hit ) {
$count++;
               next unless ( $v > 0);
                  print "hit name is ", $hit->name, "\n";
                 while( my $hsp = $hit->next_hsp ) {
                 print "score is ", $hsp->score, "\n";
		 my $aln=$hsp->get_aln();
		 my $out= Bio::AlignIO->newFh(-format => 'fasta');
		 print $out $aln;
		                }           }
           }
      }
  }

Dr Anthony Underwood
Bioinformatics Unit
Central Public Health Laboratory
61 Colindale Avenue
London
NW9 5HT
t:    0208 2004400 ext. 3618
f:    0208 3583138
e: aunderwood@phls.org.uk



**************************************************************************
The information contained in the EMail and any attachments is confidential
and intended solely and for the attention and use of the named addressee(s).
It may not be disclosed to any other person without the express authority of
the PHLS, or the intended recipient, or both. If you are not the intended
recipient, you must not disclose, copy, distribute or retain this message or
any part of it.

For information on how to send data to the PHLS in encrypted form via
E.Mail, visit www.phls.org.uk.

This footnote also confirms that this EMail has been swept for computer
viruses, but please re-sweep any attachments before opening or saving.

HTTP://www.phls.org.uk
**************************************************************************
_______________________________________________
Bioperl-l mailing list
Bioperl-l@bioperl.org
http://bioperl.org/mailman/listinfo/bioperl-l