Connecting Tech Pros Worldwide Forums | Help | Site Map

First ten hits, blast scripts

Newbie
 
Join Date: Jul 2009
Posts: 2
#1: Jul 15 '09
hi, I need help with my blast script. I need to specify that i need only the first ten hits, any idea how i could go about that?Thanks. here;s the script

Expand|Select|Wrap|Line Numbers
  1. #! /usr/bin/perl
  2. use warnings;
  3. use strict;
  4.  
  5. use Bio::SeqIO;
  6. use Bio::Seq;
  7. use Bio::Tools::Run::StandAloneBlast;
  8.  
  9. my $seqio_obj;
  10. my $seq_obj;
  11. my @params;
  12. my $blast_obj;
  13. my $result_obj;
  14. my $report_obj;
  15.  
  16. $seqio_obj = Bio::SeqIO->new(-file => 'seq.fasta',
  17. -format => 'fasta' );
  18. # to wrtie the sequence to afasta file
  19. $seq_obj = $seqio_obj->next_seq;
  20. #print $seq_obj->seq,"\n";
  21. @params = (program => 'blastp',
  22. database => 'pdbaa',
  23. outfile => 'blast1.out');
  24. $blast_obj = Bio::Tools::Run::StandAloneBlast->new(@params);
  25. $report_obj = $blast_obj->blastall($seq_obj);
  26. $result_obj = $report_obj->next_result;
  27. print $result_obj->num_hits;
  28.  

numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,573
#2: Jul 19 '09

re: First ten hits, blast scripts


First, please use code tags. They are required around any and all code that you post in the forums.

Second, I don't really know all that much about BioPerl, but if you only want the first 10 of something, cycle through it and use a counter, exiting once it is greater than 10. Just a thought.

Regards,

Jeff
Reply