Remote Blast and Report

View: New views
11 Messages — Rating Filter:   Alert me  

Remote Blast and Report

by Ocar Campos-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hello:

   I'm working in a script to remote blast a file with some sequences, I
already got the part of sending the query to blast, but I do not get the
idea of how retrieve a txt report, I mean, like the one you get by running a
blast via web and you can read in a plane text editor.

This is what I've done so far:


use Bio::Tools::Run::RemoteBlast;
use Bio::SearchIO;

$prog = "tblastx";
$db = "nr";
$e_val = "1e-10";
$remoteBlast = Bio::Tools::Run::RemoteBlast->new(-prog => $prog,
                         -data => $db,
                         -expect => $e_val
                         -readmethod => 'Blast');

#I select the file to make que query and do the blast.
$infile = 'file.input.fasta';
$r = $remoteBlast->submit_blast($infile);

#this should be the report i get.
$outfile = 'got.output';

further than this I've tried some things but none of them work, anybody who
could give an idea of how retrieving the plane text reports please?

Cheers.

O'car
_______________________________________________
Bioperl-l mailing list
Bioperl-l@...
http://lists.open-bio.org/mailman/listinfo/bioperl-l

Re: Remote Blast and Report

by Scott Markel :: Rate this Message:

| View Threaded | Show Only this Message

O'car,

There's a polling mechanism you need to use.  See the example in the
Bio::Tools::Run::RemoteBlast module.  Start looking around line 60.

Scott

Scott Markel, Ph.D.
Principal Bioinformatics Architect  email:  smarkel@...
Accelrys (SciTegic R&D)             mobile: +1 858 205 3653
10188 Telesis Court, Suite 100      voice:  +1 858 799 5603
San Diego, CA 92121                 fax:    +1 858 799 5222
USA                                 web:    http://www.accelrys.com

http://www.linkedin.com/in/smarkel
Vice President, Board of Directors:
    International Society for Computational Biology
Co-chair: ISCB Publications Committee
Associate Editor: PLoS Computational Biology
Editorial Board: Briefings in Bioinformatics


> -----Original Message-----
> From: bioperl-l-bounces@... [mailto:bioperl-l-
> bounces@...] On Behalf Of Ocar Campos
> Sent: Wednesday, 25 February 2009 4:04 PM
> To: Bioperl Mailing List.
> Subject: [Bioperl-l] Remote Blast and Report
>
> Hello:
>
>    I'm working in a script to remote blast a file with some sequences, I
> already got the part of sending the query to blast, but I do not get the
> idea of how retrieve a txt report, I mean, like the one you get by running
> a
> blast via web and you can read in a plane text editor.
>
> This is what I've done so far:
>
>
> use Bio::Tools::Run::RemoteBlast;
> use Bio::SearchIO;
>
> $prog = "tblastx";
> $db = "nr";
> $e_val = "1e-10";
> $remoteBlast = Bio::Tools::Run::RemoteBlast->new(-prog => $prog,
>                          -data => $db,
>                          -expect => $e_val
>                          -readmethod => 'Blast');
>
> #I select the file to make que query and do the blast.
> $infile = 'file.input.fasta';
> $r = $remoteBlast->submit_blast($infile);
>
> #this should be the report i get.
> $outfile = 'got.output';
>
> further than this I've tried some things but none of them work, anybody
> who
> could give an idea of how retrieving the plane text reports please?
>
> Cheers.
>
> O'car
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@...
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

_______________________________________________
Bioperl-l mailing list
Bioperl-l@...
http://lists.open-bio.org/mailman/listinfo/bioperl-l

Re: Remote Blast and Report

by Ocar Campos-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hello,

     I was reading the documentation, and I tried some new code, but when
retrieving I get an error, this is the error: Can't call method "query_name"
on an undefined value at ./aer2.pl line 44, <GEN4> line 185. I'm working
with only one sequence first, but then I am suppose to work with more than
50 sequences. Here is my code, that looks quite much as the one in the
documentation and some examples I found. Any idea or help that you could
give me please?

use Bio::Tools::Run::RemoteBlast;
use Bio::SearchIO;

#Here i set the parameters for blast
$prog = "tblastx";
$db = "nr";
$e_val = "1e-10";
$remoteBlast = Bio::Tools::Run::RemoteBlast->new(-prog => $prog,
                         -data => $db,
                         -expect => $e_val
                         -readmethod => 'txt'
                         );

#Select the file and make the balst.
$infile = infile.fasta';
$r = $remoteBlast->submit_blast($infile);

#Here i was suppose to get the blast report.
while (@reqIDs = $remoteBlast->each_rid )
{
    print STDERR join(" ", "\nINFO RIDs: ", @reqIDs), "\n";

    foreach $reqID (@reqIDs)
    {
    $rc = $remoteBlast->retrieve_blast($reqID); #With this I should get the
report.
    if( !ref($rc) )
     {
          if( $rc < 0 ) { #If  there's no hits.
            $remoteBlast->remove_rid($rid);
                           }
          print STDERR "." if ( $v > 0 );
          sleep 5;
       }
        else
        {
          $result = $rc->next_result();
          $filename = $result->query_name()."\.out";  #this should save the
report, but here i get error.
          $remoteBlast->save_output($filename);
          $remoteBlast->remove_rid($rid);
          print "\nQuery Name: ", $result->query_name(), "\n";
          while (  $hit = $result->next_hit )
           {
              next unless ( $v > 0);
              print "\thit name is ", $hit->name, "\n";
              while(  $hsp = $hit->next_hsp )
              {
                 print "\t\tscore is ", $hsp->score, "\n";
               }
           }
        }


    }

}


2009/2/25 Scott Markel <SMarkel@...>

> O'car,
>
> There's a polling mechanism you need to use.  See the example in the
> Bio::Tools::Run::RemoteBlast module.  Start looking around line 60.
>
> Scott
>
> Scott Markel, Ph.D.
> Principal Bioinformatics Architect  email:  smarkel@...
> Accelrys (SciTegic R&D)             mobile: +1 858 205 3653
> 10188 Telesis Court, Suite 100      voice:  +1 858 799 5603
> San Diego, CA 92121                 fax:    +1 858 799 5222
> USA                                 web:    http://www.accelrys.com
>
> http://www.linkedin.com/in/smarkel
> Vice President, Board of Directors:
>    International Society for Computational Biology
> Co-chair: ISCB Publications Committee
> Associate Editor: PLoS Computational Biology
> Editorial Board: Briefings in Bioinformatics
>
>
> > -----Original Message-----
> > From: bioperl-l-bounces@... [mailto:bioperl-l-
> > bounces@...] On Behalf Of Ocar Campos
> > Sent: Wednesday, 25 February 2009 4:04 PM
> > To: Bioperl Mailing List.
> > Subject: [Bioperl-l] Remote Blast and Report
> >
> > Hello:
> >
> >    I'm working in a script to remote blast a file with some sequences, I
> > already got the part of sending the query to blast, but I do not get the
> > idea of how retrieve a txt report, I mean, like the one you get by
> running
> > a
> > blast via web and you can read in a plane text editor.
> >
> > This is what I've done so far:
> >
> >
> > use Bio::Tools::Run::RemoteBlast;
> > use Bio::SearchIO;
> >
> > $prog = "tblastx";
> > $db = "nr";
> > $e_val = "1e-10";
> > $remoteBlast = Bio::Tools::Run::RemoteBlast->new(-prog => $prog,
> >                          -data => $db,
> >                          -expect => $e_val
> >                          -readmethod => 'Blast');
> >
> > #I select the file to make que query and do the blast.
> > $infile = 'file.input.fasta';
> > $r = $remoteBlast->submit_blast($infile);
> >
> > #this should be the report i get.
> > $outfile = 'got.output';
> >
> > further than this I've tried some things but none of them work, anybody
> > who
> > could give an idea of how retrieving the plane text reports please?
> >
> > Cheers.
> >
> > O'car
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l@...
> > http://lists.open-bio.org/mailman/listinfo/bioperl-l
>



--
...the pain is momentary, the glory is forever...
_______________________________________________
Bioperl-l mailing list
Bioperl-l@...
http://lists.open-bio.org/mailman/listinfo/bioperl-l

Re: Remote Blast and Report

by Smithies, Russell :: Rate this Message:

| View Threaded | Show Only this Message

Works fine for me using the code below.
Took about 30 seconds to return a result.
==============================================

#!perl -w

use Bio::Tools::Run::RemoteBlast;
use Bio::SearchIO;
use Data::Dumper;

#Here i set the parameters for blast
$prog = "tblastx";
$db = "nr";
$e_val = "1e-10";

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

my $remoteBlast = Bio::Tools::Run::RemoteBlast->new(@params);


#Select the file and make the balst.
$infile = 'infile.fasta';
$r = $remoteBlast->submit_blast($infile);

  my $v = 1;

    print STDERR "waiting..." if( $v > 0 );  ########  WAIT FOR THE RESULTS TO RETURN!!!!!
    while ( my @rids = $remoteBlast->each_rid ) {
      foreach my $rid ( @rids ) {
        my $rc = $remoteBlast->retrieve_blast($rid);
        if( !ref($rc) ) {
          if( $rc < 0 ) {
            $remoteBlast->remove_rid($rid);
          }
          print STDERR "." if ( $v > 0 );
          sleep 5;
        } else {
          my $result = $rc->next_result();
          #save the output
          my $filename = $result->query_name()."\.out";
          $remoteBlast->save_output($filename);
          $remoteBlast->remove_rid($rid);
          print "\nQuery Name: ", $result->query_name(), "\n";
          while ( my $hit = $result->next_hit ) {
            next unless ( $v > 0);
            print "\thit name is ", $hit->name, "\n";
            while( my $hsp = $hit->next_hsp ) {
              print "\t\tscore is ", $hsp->score, "\n";
            }
          }
        }
      }
    }

=================================================================

> -----Original Message-----
> From: bioperl-l-bounces@... [mailto:bioperl-l-
> bounces@...] On Behalf Of Ocar Campos
> Sent: Friday, 27 February 2009 9:29 a.m.
> To: Scott Markel
> Cc: Bioperl Mailing List.
> Subject: Re: [Bioperl-l] Remote Blast and Report
>
> Hello,
>
>      I was reading the documentation, and I tried some new code, but when
> retrieving I get an error, this is the error: Can't call method "query_name"
> on an undefined value at ./aer2.pl line 44, <GEN4> line 185. I'm working
> with only one sequence first, but then I am suppose to work with more than
> 50 sequences. Here is my code, that looks quite much as the one in the
> documentation and some examples I found. Any idea or help that you could
> give me please?
>
> use Bio::Tools::Run::RemoteBlast;
> use Bio::SearchIO;
>
> #Here i set the parameters for blast
> $prog = "tblastx";
> $db = "nr";
> $e_val = "1e-10";
> $remoteBlast = Bio::Tools::Run::RemoteBlast->new(-prog => $prog,
>                          -data => $db,
>                          -expect => $e_val
>                          -readmethod => 'txt'
>                          );
>
> #Select the file and make the balst.
> $infile = infile.fasta';
> $r = $remoteBlast->submit_blast($infile);
>
> #Here i was suppose to get the blast report.
> while (@reqIDs = $remoteBlast->each_rid )
> {
>     print STDERR join(" ", "\nINFO RIDs: ", @reqIDs), "\n";
>
>     foreach $reqID (@reqIDs)
>     {
>     $rc = $remoteBlast->retrieve_blast($reqID); #With this I should get the
> report.
>     if( !ref($rc) )
>      {
>           if( $rc < 0 ) { #If  there's no hits.
>             $remoteBlast->remove_rid($rid);
>                            }
>           print STDERR "." if ( $v > 0 );
>           sleep 5;
>        }
>         else
>         {
>           $result = $rc->next_result();
>           $filename = $result->query_name()."\.out";  #this should save the
> report, but here i get error.
>           $remoteBlast->save_output($filename);
>           $remoteBlast->remove_rid($rid);
>           print "\nQuery Name: ", $result->query_name(), "\n";
>           while (  $hit = $result->next_hit )
>            {
>               next unless ( $v > 0);
>               print "\thit name is ", $hit->name, "\n";
>               while(  $hsp = $hit->next_hsp )
>               {
>                  print "\t\tscore is ", $hsp->score, "\n";
>                }
>            }
>         }
>
>
>     }
>
> }
>
>
> 2009/2/25 Scott Markel <SMarkel@...>
>
> > O'car,
> >
> > There's a polling mechanism you need to use.  See the example in the
> > Bio::Tools::Run::RemoteBlast module.  Start looking around line 60.
> >
> > Scott
> >
> > Scott Markel, Ph.D.
> > Principal Bioinformatics Architect  email:  smarkel@...
> > Accelrys (SciTegic R&D)             mobile: +1 858 205 3653
> > 10188 Telesis Court, Suite 100      voice:  +1 858 799 5603
> > San Diego, CA 92121                 fax:    +1 858 799 5222
> > USA                                 web:    http://www.accelrys.com
> >
> > http://www.linkedin.com/in/smarkel
> > Vice President, Board of Directors:
> >    International Society for Computational Biology
> > Co-chair: ISCB Publications Committee
> > Associate Editor: PLoS Computational Biology
> > Editorial Board: Briefings in Bioinformatics
> >
> >
> > > -----Original Message-----
> > > From: bioperl-l-bounces@... [mailto:bioperl-l-
> > > bounces@...] On Behalf Of Ocar Campos
> > > Sent: Wednesday, 25 February 2009 4:04 PM
> > > To: Bioperl Mailing List.
> > > Subject: [Bioperl-l] Remote Blast and Report
> > >
> > > Hello:
> > >
> > >    I'm working in a script to remote blast a file with some sequences, I
> > > already got the part of sending the query to blast, but I do not get the
> > > idea of how retrieve a txt report, I mean, like the one you get by
> > running
> > > a
> > > blast via web and you can read in a plane text editor.
> > >
> > > This is what I've done so far:
> > >
> > >
> > > use Bio::Tools::Run::RemoteBlast;
> > > use Bio::SearchIO;
> > >
> > > $prog = "tblastx";
> > > $db = "nr";
> > > $e_val = "1e-10";
> > > $remoteBlast = Bio::Tools::Run::RemoteBlast->new(-prog => $prog,
> > >                          -data => $db,
> > >                          -expect => $e_val
> > >                          -readmethod => 'Blast');
> > >
> > > #I select the file to make que query and do the blast.
> > > $infile = 'file.input.fasta';
> > > $r = $remoteBlast->submit_blast($infile);
> > >
> > > #this should be the report i get.
> > > $outfile = 'got.output';
> > >
> > > further than this I've tried some things but none of them work, anybody
> > > who
> > > could give an idea of how retrieving the plane text reports please?
> > >
> > > Cheers.
> > >
> > > O'car
> > > _______________________________________________
> > > Bioperl-l mailing list
> > > Bioperl-l@...
> > > http://lists.open-bio.org/mailman/listinfo/bioperl-l
> >
>
>
>
> --
> ...the pain is momentary, the glory is forever...
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@...
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
=======================================================================
Attention: The information contained in this message and/or attachments
from AgResearch Limited is intended only for the persons or entities
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipients is prohibited by AgResearch
Limited. If you have received this message in error, please notify the
sender immediately.
=======================================================================

_______________________________________________
Bioperl-l mailing list
Bioperl-l@...
http://lists.open-bio.org/mailman/listinfo/bioperl-l

Re: Remote Blast and Report

by Ocar Campos-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hello, I tried your script Russel, but I still got the same error in the
console, "Can't call method "query_name" on an undefined value at ./aer2.pl
line 39, <GEN4> line 185.", I didn't do anything to it, just copy/paste and
ran it. So what I assumed is that the object for the SearchIO module was not
initialized, so I created it, but now I get an Exeption while parsing the
report:


------------- EXCEPTION  -------------
MSG: Could not open Bio::SearchIO::blast=HASH(0x8bb79bc): Doesn't exist the
file or directory.
STACK Bio::Root::IO::_initialize_io
/usr/lib/perl5/site_perl/5.8.8/Bio/Root/IO.pm:273
STACK Bio::Root::IO::new /usr/lib/perl5/site_perl/5.8.8/Bio/Root/IO.pm:213
STACK Bio::SearchIO::new /usr/lib/perl5/site_perl/5.8.8/Bio/SearchIO.pm:135
STACK Bio::SearchIO::new /usr/lib/perl5/site_perl/5.8.8/Bio/SearchIO.pm:167
STACK toplevel ./aer2.pl:45

--------------------------------------

aer2.pl is my script, Any Idea what it could be?

The script:

#!/usr/bin/perl

use Bio::Tools::Run::RemoteBlast;
use Bio::SearchIO;
use Data::Dumper;

########HERE I SET THE PARAMETERS
$prog = "tblastx";
$db = "nr";
$e_val = "1e-10";

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

my $remoteBlast = Bio::Tools::Run::RemoteBlast->new(@params);


########SELECT FILE AND RUN THE BLAST.
$infile = 'secuencia.fasta';
$r = $remoteBlast->submit_blast($infile);

 my $v = 1;

   print STDERR "waiting...\n" if( $v > 0 );  ########  WAIT FOR THE RESULTS
TO RETURN!!!!!
   while ( my @rids = $remoteBlast->each_rid )
   {
     foreach my $rid ( @rids )
     {
       my $rc = $remoteBlast->retrieve_blast($rid);  ###I RETRIEVE THE
REPORT.
       print $rc, "\n";                  ########ONLY FOR CHECKING
       if( !ref($rc) )
       {
         if( $rc < 0 )
         {
           $remoteBlast->remove_rid($rid);
         }
         print STDERR "." if ( $v > 0 );
         sleep 5;
       }
       else
       {
        ##########HERE I CREATE THE SEARCHIO OBJECT FOR WORKING WITH THE
REPORT
        $report = new Bio::SearchIO (-format => 'blast',
                                     -file   => $rc      #########$rc SHOULD
CONTAIN THE REPORT
                      );
        my $result = $report->next_result();
        #########SAVE THE OUTPUT
        my $filename = $result->query_name()."\.out";
        $remoteBlast->save_output($filename);
        $remoteBlast->remove_rid($rid);
        print "\nQuery Name: ", $result->query_name(), "\n";
        while ( my $hit = $result->next_hit )
        {
          next unless ( $v > 0);
          print "\thit name is ", $hit->name, "\n";
          while( my $hsp = $hit->next_hsp )
          {
            print "\t\tscore is ", $hsp->score, "\n";
          }
        }
       }
      }
    }


Thanks in advance.
Cheers.
O'car.
_______________________________________________
Bioperl-l mailing list
Bioperl-l@...
http://lists.open-bio.org/mailman/listinfo/bioperl-l

Re: Remote Blast and Report

by Jason Stajich-3 :: Rate this Message:

| View Threaded | Show Only this Message

I think $rc is already a Bio::SearchIO object - you shouldn't have to  
instantiate a Bio::SearchIO object that is what the -readmethod in the  
@params at the top is for.

Try printing ref($ref) to see what it is.

-js
On Mar 1, 2009, at 4:51 PM, Ocar Campos wrote:

> Hello, I tried your script Russel, but I still got the same error in  
> the
> console, "Can't call method "query_name" on an undefined value at ./
> aer2.pl
> line 39, <GEN4> line 185.", I didn't do anything to it, just copy/
> paste and
> ran it. So what I assumed is that the object for the SearchIO module  
> was not
> initialized, so I created it, but now I get an Exeption while  
> parsing the
> report:
>
>
> ------------- EXCEPTION  -------------
> MSG: Could not open Bio::SearchIO::blast=HASH(0x8bb79bc): Doesn't  
> exist the
> file or directory.
> STACK Bio::Root::IO::_initialize_io
> /usr/lib/perl5/site_perl/5.8.8/Bio/Root/IO.pm:273
> STACK Bio::Root::IO::new /usr/lib/perl5/site_perl/5.8.8/Bio/Root/
> IO.pm:213
> STACK Bio::SearchIO::new /usr/lib/perl5/site_perl/5.8.8/Bio/
> SearchIO.pm:135
> STACK Bio::SearchIO::new /usr/lib/perl5/site_perl/5.8.8/Bio/
> SearchIO.pm:167
> STACK toplevel ./aer2.pl:45
>
> --------------------------------------
>
> aer2.pl is my script, Any Idea what it could be?
>
> The script:
>
> #!/usr/bin/perl
>
> use Bio::Tools::Run::RemoteBlast;
> use Bio::SearchIO;
> use Data::Dumper;
>
> ########HERE I SET THE PARAMETERS
> $prog = "tblastx";
> $db = "nr";
> $e_val = "1e-10";
>
> my @params = ( '-prog' => $prog,
>        '-data' => $db,
>        '-expect' => $e_val,
>        '-readmethod' => 'SearchIO' );
>
> my $remoteBlast = Bio::Tools::Run::RemoteBlast->new(@params);
>
>
> ########SELECT FILE AND RUN THE BLAST.
> $infile = 'secuencia.fasta';
> $r = $remoteBlast->submit_blast($infile);
>
> my $v = 1;
>
>   print STDERR "waiting...\n" if( $v > 0 );  ########  WAIT FOR THE  
> RESULTS
> TO RETURN!!!!!
>   while ( my @rids = $remoteBlast->each_rid )
>   {
>     foreach my $rid ( @rids )
>     {
>       my $rc = $remoteBlast->retrieve_blast($rid);  ###I RETRIEVE THE
> REPORT.
>       print $rc, "\n";                  ########ONLY FOR CHECKING
>       if( !ref($rc) )
>       {
>         if( $rc < 0 )
>         {
>           $remoteBlast->remove_rid($rid);
>         }
>         print STDERR "." if ( $v > 0 );
>         sleep 5;
>       }
>       else
>       {
>        ##########HERE I CREATE THE SEARCHIO OBJECT FOR WORKING WITH  
> THE
> REPORT
>        $report = new Bio::SearchIO (-format => 'blast',
>                                     -file   => $rc      #########$rc  
> SHOULD
> CONTAIN THE REPORT
>                      );
>        my $result = $report->next_result();
>        #########SAVE THE OUTPUT
>        my $filename = $result->query_name()."\.out";
>        $remoteBlast->save_output($filename);
>        $remoteBlast->remove_rid($rid);
>        print "\nQuery Name: ", $result->query_name(), "\n";
>        while ( my $hit = $result->next_hit )
>        {
>          next unless ( $v > 0);
>          print "\thit name is ", $hit->name, "\n";
>          while( my $hsp = $hit->next_hsp )
>          {
>            print "\t\tscore is ", $hsp->score, "\n";
>          }
>        }
>       }
>      }
>    }
>
>
> Thanks in advance.
> Cheers.
> O'car.
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@...
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

Jason Stajich
jason@...



_______________________________________________
Bioperl-l mailing list
Bioperl-l@...
http://lists.open-bio.org/mailman/listinfo/bioperl-l

Re: Remote Blast and Report

by Ocar Campos-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hello Jason, I printed the ref($ref), this is what i got:
Bio::SearchIO::blast

I'm going to update from version 1.4.2 of bioperl to 1.6.0, maybe that's why
is not working.

O'car

2009/3/1 Jason Stajich <jason@...>

> I think $rc is already a Bio::SearchIO object - you shouldn't have to
> instantiate a Bio::SearchIO object that is what the -readmethod in the
> @params at the top is for.
>
> Try printing ref($ref) to see what it is.
>
> -js
>
> On Mar 1, 2009, at 4:51 PM, Ocar Campos wrote:
>
>  Hello, I tried your script Russel, but I still got the same error in the
>> console, "Can't call method "query_name" on an undefined value at
>> ./aer2.pl
>> line 39, <GEN4> line 185.", I didn't do anything to it, just copy/paste
>> and
>> ran it. So what I assumed is that the object for the SearchIO module was
>> not
>> initialized, so I created it, but now I get an Exeption while parsing the
>> report:
>>
>>
>> ------------- EXCEPTION  -------------
>> MSG: Could not open Bio::SearchIO::blast=HASH(0x8bb79bc): Doesn't exist
>> the
>> file or directory.
>> STACK Bio::Root::IO::_initialize_io
>> /usr/lib/perl5/site_perl/5.8.8/Bio/Root/IO.pm:273
>> STACK Bio::Root::IO::new /usr/lib/perl5/site_perl/5.8.8/Bio/Root/IO.pm:213
>> STACK Bio::SearchIO::new
>> /usr/lib/perl5/site_perl/5.8.8/Bio/SearchIO.pm:135
>> STACK Bio::SearchIO::new
>> /usr/lib/perl5/site_perl/5.8.8/Bio/SearchIO.pm:167
>> STACK toplevel ./aer2.pl:45
>>
>> --------------------------------------
>>
>> aer2.pl is my script, Any Idea what it could be?
>>
>> The script:
>>
>> #!/usr/bin/perl
>>
>> use Bio::Tools::Run::RemoteBlast;
>> use Bio::SearchIO;
>> use Data::Dumper;
>>
>> ########HERE I SET THE PARAMETERS
>> $prog = "tblastx";
>> $db = "nr";
>> $e_val = "1e-10";
>>
>> my @params = ( '-prog' => $prog,
>>       '-data' => $db,
>>       '-expect' => $e_val,
>>       '-readmethod' => 'SearchIO' );
>>
>> my $remoteBlast = Bio::Tools::Run::RemoteBlast->new(@params);
>>
>>
>> ########SELECT FILE AND RUN THE BLAST.
>> $infile = 'secuencia.fasta';
>> $r = $remoteBlast->submit_blast($infile);
>>
>> my $v = 1;
>>
>>  print STDERR "waiting...\n" if( $v > 0 );  ########  WAIT FOR THE RESULTS
>> TO RETURN!!!!!
>>  while ( my @rids = $remoteBlast->each_rid )
>>  {
>>    foreach my $rid ( @rids )
>>    {
>>      my $rc = $remoteBlast->retrieve_blast($rid);  ###I RETRIEVE THE
>> REPORT.
>>      print $rc, "\n";                  ########ONLY FOR CHECKING
>>      if( !ref($rc) )
>>      {
>>        if( $rc < 0 )
>>        {
>>          $remoteBlast->remove_rid($rid);
>>        }
>>        print STDERR "." if ( $v > 0 );
>>        sleep 5;
>>      }
>>      else
>>      {
>>       ##########HERE I CREATE THE SEARCHIO OBJECT FOR WORKING WITH THE
>> REPORT
>>       $report = new Bio::SearchIO (-format => 'blast',
>>                                    -file   => $rc      #########$rc SHOULD
>> CONTAIN THE REPORT
>>                     );
>>       my $result = $report->next_result();
>>       #########SAVE THE OUTPUT
>>       my $filename = $result->query_name()."\.out";
>>       $remoteBlast->save_output($filename);
>>       $remoteBlast->remove_rid($rid);
>>       print "\nQuery Name: ", $result->query_name(), "\n";
>>       while ( my $hit = $result->next_hit )
>>       {
>>         next unless ( $v > 0);
>>         print "\thit name is ", $hit->name, "\n";
>>         while( my $hsp = $hit->next_hsp )
>>         {
>>           print "\t\tscore is ", $hsp->score, "\n";
>>         }
>>       }
>>      }
>>     }
>>   }
>>
>>
>> Thanks in advance.
>> Cheers.
>> O'car.
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l@...
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>
>
> Jason Stajich
> jason@...
>
>
>
>


--
O'car Campos C.
Bioinformatics Engineering Student.
Universidad de Talca.
_______________________________________________
Bioperl-l mailing list
Bioperl-l@...
http://lists.open-bio.org/mailman/listinfo/bioperl-l

Re: Remote Blast and Report

by Ocar Campos-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hello Everybody!
Finally I got the script working, It was a problem of the version of my
BioPerl, I updated to 1.6 and now the script is working fine, I use the one
that Russel send, that is this one, and got no problem

#!perl -w

use Bio::Tools::Run::RemoteBlast;
use Bio::SearchIO;
use Data::Dumper;

#Here i set the parameters for blast
$prog = "tblastx";
$db = "nr";
$e_val = "1e-10";

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

my $remoteBlast = Bio::Tools::Run::RemoteBlast->new(@params);


#Select the file and make the balst.
$infile = 'infile.fasta';
$r = $remoteBlast->submit_blast($infile);

  my $v = 1;

   print STDERR "waiting..." if( $v > 0 );  ########  WAIT FOR THE RESULTS
TO RETURN!!!!!
   while ( my @rids = $remoteBlast->each_rid ) {
     foreach my $rid ( @rids ) {
       my $rc = $remoteBlast->retrieve_blast($rid);
        if( !ref($rc) ) {
         if( $rc < 0 ) {
            $remoteBlast->remove_rid($rid);
         }
         print STDERR "." if ( $v > 0 );
         sleep 5;
       } else {
          my $result = $rc->next_result();
         #save the output
         my $filename = $result->query_name()."\.out";
          $remoteBlast->save_output($filename);
         $remoteBlast->remove_rid($rid);
         print "\nQuery Name: ", $result->query_name(), "\n";
          while ( my $hit = $result->next_hit ) {
            next unless ( $v > 0);
           print "\thit name is ", $hit->name, "\n";
            while( my $hsp = $hit->next_hsp ) {
              print "\t\tscore is ", $hsp->score, "\n";
           }
         }
       }
     }
   }

Thanks Everybody for the help, and the Ideas!

Cheers!
--
O'car Campos C.
Bioinformatics Engineering Student.
Universidad de Talca.
_______________________________________________
Bioperl-l mailing list
Bioperl-l@...
http://lists.open-bio.org/mailman/listinfo/bioperl-l

Re: Remote Blast and Report

by gopu_36 :: Rate this Message:

| View Threaded | Show Only this Message

Hi,

I am kind of new to bioperl and will definitely check the version before I start. I have a very similar situation to run remote blast but against refseq database. I have a set of accession numbers for which I am intending to run remote blast and parse the results. I was looking for some example to blast against refsef. Hence do I have to modify as below?

$prog = "blastn";
$db = "refseq_rna";


My next doubt is since I have around 800 ACCESSION nos, do I have to instantiate the below line that many times inside the loop?

$remoteBlast = Bio::Tools::Run::RemoteBlast->new(-prog => $prog,
                         -data => $db,
                         -expect => $e_val
                         -readmethod => 'Blast');


Thanks and Regards.

Ocar Campos-2 wrote:
Hello:

   I'm working in a script to remote blast a file with some sequences, I
already got the part of sending the query to blast, but I do not get the
idea of how retrieve a txt report, I mean, like the one you get by running a
blast via web and you can read in a plane text editor.

This is what I've done so far:


use Bio::Tools::Run::RemoteBlast;
use Bio::SearchIO;

$prog = "tblastx";
$db = "nr";
$e_val = "1e-10";
$remoteBlast = Bio::Tools::Run::RemoteBlast->new(-prog => $prog,
                         -data => $db,
                         -expect => $e_val
                         -readmethod => 'Blast');

#I select the file to make que query and do the blast.
$infile = 'file.input.fasta';
$r = $remoteBlast->submit_blast($infile);

#this should be the report i get.
$outfile = 'got.output';

further than this I've tried some things but none of them work, anybody who
could give an idea of how retrieving the plane text reports please?

Cheers.

O'car
_______________________________________________
Bioperl-l mailing list
Bioperl-l@lists.open-bio.org
http://lists.open-bio.org/mailman/listinfo/bioperl-l

Re: Re mote Blast and Report

by Ocar Campos-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hello:

According to the documentation, depending on the database you want to use,
you modify the parameter, so what you did I think it should work, there is a
list of databases you can remoteblast and that is this one:
http://www.ncbi.nlm.nih.gov/staff/tao/URLAPI/remote_blastdblist.html
I think General Databases is where you should search.

About the 800 Accession Numbers, wether you have the accesion numbers all in
one file or in different files, i think the creation of the object should
work doing it only once, what you should have in the loop is the line that
sends the file to blast, and the lines that parse the report, this only if
you have the accession numbers in more than one file.

Hope it helps.

Cheers

O'car Campos C.
Bioinformatics Engineering Student.
Universidad de Talca.


--
2009/3/3 gopu_36 <gopu_36@...>

>
> Hi,
>
> I am kind of new to bioperl and will definitely check the version before I
> start. I have a very similar situation to run remote blast but against
> refseq database. I have a set of accession numbers for which I am intending
> to run remote blast and parse the results. I was looking for some example
> to
> blast against refsef. Hence do I have to modify as below?
>
> $prog = "blastn";
> $db = "refseq_rna";
>
>
> My next doubt is since I have around 800 ACCESSION nos, do I have to
> instantiate the below line that many times inside the loop?
>
> $remoteBlast = Bio::Tools::Run::RemoteBlast->new(-prog => $prog,
>                         -data => $db,
>                         -expect => $e_val
>                         -readmethod => 'Blast');
>
>
> Thanks and Regards.
>
>
> Ocar Campos-2 wrote:
> >
> > Hello:
> >
> >    I'm working in a script to remote blast a file with some sequences, I
> > already got the part of sending the query to blast, but I do not get the
> > idea of how retrieve a txt report, I mean, like the one you get by
> running
> > a
> > blast via web and you can read in a plane text editor.
> >
> > This is what I've done so far:
> >
> >
> > use Bio::Tools::Run::RemoteBlast;
> > use Bio::SearchIO;
> >
> > $prog = "tblastx";
> > $db = "nr";
> > $e_val = "1e-10";
> > $remoteBlast = Bio::Tools::Run::RemoteBlast->new(-prog => $prog,
> >                          -data => $db,
> >                          -expect => $e_val
> >                          -readmethod => 'Blast');
> >
> > #I select the file to make que query and do the blast.
> > $infile = 'file.input.fasta';
> > $r = $remoteBlast->submit_blast($infile);
> >
> > #this should be the report i get.
> > $outfile = 'got.output';
> >
> > further than this I've tried some things but none of them work, anybody
> > who
> > could give an idea of how retrieving the plane text reports please?
> >
> > Cheers.
> >
> > O'car
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l@...
> > http://lists.open-bio.org/mailman/listinfo/bioperl-l
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Remote-Blast-and-Report-tp22214949p22309761.html
> Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@...
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
_______________________________________________
Bioperl-l mailing list
Bioperl-l@...
http://lists.open-bio.org/mailman/listinfo/bioperl-l

Parent Message unknown Re: Remote Blast and Report

by Ocar Campos-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hello:

Try checking on what BioPerl version you are working with, I had the same
problem, I was working with 1.4 version, and now it has been released the
1.6 version, so I updated and worked fine.

Cheers.

O'car Campos C.
Bioinformatics Engineering Student.
Universidad de Talca.
_______________________________________________
Bioperl-l mailing list
Bioperl-l@...
http://lists.open-bio.org/mailman/listinfo/bioperl-l