Connecting Tech Pros Worldwide Forums | Help | Site Map

Standalone Blast

Newbie
 
Join Date: Sep 2007
Posts: 2
#1: Sep 18 '07
Does anyone help me with the script of standalone blast that will execute the blastn, blastp and tblastx, with one script and e values, and hits, and score

numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,573
#2: Sep 18 '07

re: Standalone Blast


Quote:

Originally Posted by Nandu123

Does anyone help me with the script of standalone blast that will execute the blastn, blastp and tblastx, with one script and e values, and hits, and score

This is the Perl forum. I do not know what blastn, blastp, and tblastx are and your question is extremely vague and not well worded. If you could further explain what you are looking for, that would be most helpful. At this point, I don't know how the Perl forum can further help you.

Regards,

Jeff
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#3: Sep 19 '07

re: Standalone Blast


Quote:

Originally Posted by Nandu123

Does anyone help me with the script of standalone blast that will execute the blastn, blastp and tblastx, with one script and e values, and hits, and score

look into bioperl: www.bioperl.org

or search CPAN: search.cpan.org
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,573
#4: Sep 19 '07

re: Standalone Blast


Quote:

Originally Posted by KevinADC

look into bioperl: www.bioperl.org

or search CPAN: search.cpan.org

You have either had exposure to that or have played with it because I hadn't a clue what they were talking about.
Newbie
 
Join Date: Sep 2007
Posts: 2
#5: Sep 19 '07

re: Standalone Blast


Hello masters!!!!!!!!!
I hope my script is a bioperl script which is related to perl of course,,,,, so should be included in the perl forum I suppose,,,,, and standalone blast is a means to use blast locally using perl/ bioperl script. So I asked it here. Again, I am facing few bugs with the "my" thus, if someone can help me,,,, to get it debug, will be great!!!!!!!

My script is as follows:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2. use strict;
  3.  
  4. # Local-blast "factory object" creation and blast-parameter:
  5.  
  6.  
  7.  # initialization:
  8. use Bio::Tools::Run::StandAloneBlast;
  9. use Bio::SeqIO;
  10. use Bio::Seq;
  11. use Bio::SearchIO;
  12.  
  13. # Process Command line arguments
  14. if(scalar @ARGV !=6){
  15.   my $usage = " ./home/blaststd.pl INPUTFILE BLASTDB PROGRAM E-CUTOFF OUTPUTFILE";
  16.    print  "Wrong number of arguments\n";
  17.    die "$usage\n";
  18.    }
  19. #the filenames containing input sequence
  20. my $input_seq1 = dna.fasta;
  21. my $input_seq2 = sequences.fasta;
  22.    $input_seq1 = $ARGV[0];
  23.    $input_seq2 =$ARGV[1];
  24. #the database to blast against
  25. my $db = $ARGV[2];
  26. # the blast program to use
  27. my $program = $ARGV[3];
  28. #the expect value (Evalue)cutoff
  29. my $cutoff = $ARGV[4];
  30. #the name of the output file
  31. my $output_file = $ARGV [5];
  32. #blast parameters with type of programs, type of database, type of file, type of method:
  33.  
  34. my @params1= ('programs'=> 'blastn','database' => 'ecoli.nt','outfile' =>'blastn.out','e 1e-10',
  35.     '_READMETHOD' => 'Blast');
  36. my @params2= ('programs'=> 'blastp','database' => 'ecoli.aa','outfile' =>'blastp.out','e 1e-10',
  37.    '_READMETHOD' => 'Blast');
  38. my @params3 = ('programs'=> 'tblastx','database' => 'ecoli.nt','outfile' =>'blastx.out','e 1e-10',
  39.     '_READMETHOD' => 'Blast');
  40.  
  41. print "Enter the type of program";
  42.  
  43. my $factory = Bio::Tools::Run::StandAloneBlast->new(@params1, @params2, @params3);
  44.  
  45.  
  46.  # Blast a sequence against a database:
  47.  
  48.  
  49.    my $in1 = Bio::SeqIO->new(-file=>'dna.fasta' , -format =>'Fasta');
  50.    my $in2= Bio::SeqIO->new(-file=>'sequences.fasta',-format=>'Fasta');
  51.  
  52. # Load the sequence into a Bio::Seq obj
  53.    my  $seq =Bio::Seq->new($in1->next_seq());
  54.    my $seq2 =Bio::Seq->new($in2->next_seq());
  55.  
  56. #my  $input2 = $str->next_seq();
  57. my  $blast_report = $factory->blastall($seq,$seq2);
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66. # Blast a sequence against a database:
  67. # format can be , 'blast', 'exonerate', ...
  68.  
  69. my $searchio1 = new Bio::SearchIO(-format => 'blastn',
  70.                                      -file => 'dna.fasta');
  71. my $searchio2= new Bio::SearchIO(-format => 'blastp',-file => 'sequences.fasta');
  72. my $searchio3 = new Bio::SearchIO(-format => 'tblastx' -file => 'dna.fasta')
  73.  
  74. while  (my $result = $searchio->next_result)
  75.     {
  76.  
  77.        while(my $hit = $result->next_hit) 
  78.     {
  79.  
  80.         # process the Bio::Search::Hit::HitI object
  81.            while(my $hsp = $hit->next_hsp )
  82.           {
  83.         # process the Bio::Search::HSP::HSPI object
  84.           if($hsp->length('total') >=. 75) 
  85.             {
  86.              print "Hit=", $hit->name,
  87.                    "len=",$hsp->length('total'),
  88.                    "percent_id=",$hsp->percent_identity,
  89.                    "Score =", my $bitsore->bits(%s),
  90.                    "Expected value=", my $evalue,"\n";
  91.                 }
  92.                }
  93.             }
  94.        }
  95.  }
  96. print "Thank you.\n";
  97.  
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#6: Sep 19 '07

re: Standalone Blast


Quote:

Originally Posted by numberwhun

You have either had exposure to that or have played with it because I hadn't a clue what they were talking about.


I have seen this question or similar asked on other forums so I have some knowledge of what it is. I have no practical experience with it though.
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#7: Sep 19 '07

re: Standalone Blast


You ned to quote barewords, like here:

Expand|Select|Wrap|Line Numbers
  1. my $input_seq1 = dna.fasta;
  2. my $input_seq2 = sequences.fasta;
  3.  
should be:

Expand|Select|Wrap|Line Numbers
  1. my $input_seq1 = 'dna.fasta';
  2. my $input_seq2 = 'sequences.fasta';
  3.  
see if that helps gets things working. If not, post the exact error messages you are getting when trying your code. I do not have any of the modules you are using installed so I can't help debug the syntax except by "eye", which I am not prepared to do.
Newbie
 
Join Date: Jul 2009
Posts: 2
#8: Jul 14 '09

re: Standalone Blast


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

#! /usr/bin/perl
use warnings;
use strict;

use Bio::SeqIO;
use Bio::Seq;
use Bio::Tools::Run::StandAloneBlast;

my $seqio_obj;
my $seq_obj;
my @params;
my $blast_obj;
my $result_obj;
my $report_obj;

$seqio_obj = Bio::SeqIO->new(-file => 'seq.fasta',
-format => 'fasta' );
# to wrtie the sequence to afasta file
$seq_obj = $seqio_obj->next_seq;
#print $seq_obj->seq,"\n";
@params = (program => 'blastp',
database => 'pdbaa',
outfile => 'blast1.out');
$blast_obj = Bio::Tools::Run::StandAloneBlast->new(@params);
$report_obj = $blast_obj->blastall($seq_obj);
$result_obj = $report_obj->next_result;
print $result_obj->num_hits;
Reply