[Bioperl-l] Exception MSG

Jason Stajich jason.stajich at gmail.com
Wed Nov 30 06:05:41 UTC 2011


I don't think you need to give it the '>' when you specify the filename for the output. That is done by the filehandle opening itsself.

On Nov 29, 2011, at 9:25 PM, Mgavi Brathwaite wrote:

> Hello,
> 
> Brushing up on my BioPerl and I can't figure out this MSG:
> 
> ------------- EXCEPTION -------------
> 
> MSG: cannot open >/Users/mydata/Desktop/gi|255572219|ref|XP_002527049|.out
> 
> STACK Bio::Tools::Run::RemoteBlast::save_output
> /Library/Perl/5.10.0/Bio/Tools/Run/RemoteBlast.pm:678
> 
> STACK toplevel /Users/mydata/Documents/workspace/BI7643/rb_ex.pl:40
> 
> -------------------------------------
> Here is the code:
> 
> #!/usr/bin/perl -w
> 
> use strict;
> 
> use Bio::Tools::Run::RemoteBlast;
> 
> 
> #=cut
> 
> 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);
> 
> 
> #human database
> 
> $Bio::Tools::Run::RemoteBlast::HEADER{'ENTREZ_QUERY'} = 'Homo sapiens
> [ORGN]';
> 
> 
> my $v =1; # this is just to turn on and off the messages
> 
> # Construct the sequence object
> 
> my $seq_in = Bio::SeqIO->new(-file => "/Users/mydata/Desktop/rb_ex.fa", -format
> => "fasta");
> 
> 
> while (my $input = $seq_in->next_seq()){
> 
> 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 {
> 
> my $result = $rc->next_result();
> 
> #save output
> 
> my $filename = ">/Users/mydata/Desktop/".$result->query_name().".out";#error
> 
> $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);
> 
>            print "\thit name is ", $hit->name, "\n";
> 
>            while( my $hsp = $hit->next_hsp ) {
> 
>              print "\t\tscore is ", $hsp->score, "\n";
> 
> }
> 
>          }
> 
>        }
> 
>      }
> 
>    }
> 
>  }
> 
> 
> 
> Thanks for the help!
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l





More information about the Bioperl-l mailing list