[Bioperl-l] remoteblast result in text format
Damien Mattei
Damien.Mattei@unice.fr
Wed, 06 Nov 2002 10:48:12 +0100
Thanks Mathieu,it works well now.
> Wiepert, Mathieu wrote:
>
>> Hi,
>>
>> Just saw this, sorry for the delay. If you look at the synopsis for
>> RemoteBlast, you can see how to save the output. What I sent you
>> earlier was not what I finally put in. You have my alpha code ;-) So
>> parseBlastObject() is garbage. I have cut and pasted the synopsis
>> into a script, and it executed (assuming it can find the test amino.fa
>> file, and I see there is a problem with the way I have the
>> $result->query_name(), keeps returning me a reference not the string
>> name,
yes i noticed too that it return HASH ref or something like but it
shouldn't be hard to fix in your code.
Another thing i don't understand is the use of the $v variable in your
program as this variable seems to remain unchanged :
>>
>> This is what I just ran...
>>
>> #!/usr/bin/perl -w
>> use Bio::Tools::Run::RemoteBlast;
>> use strict;
>> my $prog = 'blastp';
>> my $db = 'swissprot';
>> my $e_val= '1e-10';
>> my @params = ( '-prog' => $prog,
>> '-data' => $db,
>> '-expect' => $e_val, '-readmethod' => 'SearchIO' );
>>
>> my $factory = Bio::Tools::Run::RemoteBlast->new(@params);
>>
>> #change a paramter
>> $Bio::Tools::Run::RemoteBlast::HEADER{'ENTREZ_QUERY'} = 'Homo sapiens
>> [ORGN]';
>>
>> #remove a parameter
>> delete $Bio::Tools::Run::RemoteBlast::HEADER{'FILTER'};
>>
>> my $v = 1;
ok for init
>> my $str = Bio::SeqIO->new(-file=>'amino.fa' , '-format' => 'fasta' );
>> while (my $input = $str->next_seq()){
>> #Blast a sequence against a database:
>> #Alternatively, you could pass in a file with many #sequences
>> rather than loop through sequence one at a time
>> #Remove the loop starting 'while (my $input = $str->next_seq())'
>> #and swap the two lines below for an example of that.
>> my $r = $factory->submit_blast($input);
>> #my $r = $factory->submit_blast('amino.fa');
>> print STDERR "waiting..." if( $v > 0 );
tested here
>> 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 );
tested again
>> sleep 5;
>> } else { my $result = $rc->next_result();
>> #save the output
>> my $filename = $result->query_name()."\.out";
>> $factory->save_output($filename);
>> $factory->remove_rid($rid);
>> print "\nQuery Name: ", $result->query_name(), "\n";
>> while ( my $hit = $result->next_hit ) {
>> next unless ( $v > 0);
tested, $v is never modified in the program
>> print "\thit name is ", $hit->name, "\n";
>> while( my $hsp = $hit->next_hsp ) {
>> print "\t\tscore is ", $hsp->score, "\n";
>> } }
>> }
>> }
>> }
>> }
>>
Damien.
----------------------------
Damien Mattei
C.N.R.S / U.N.S.A - UMR 6549
mailto:mattei@unice.fr
http://www-iag.unice.fr/
----------------------------