[Bioperl-l] tempfile problem with standalone blast

Gopal gopal.cshl at gmail.com
Fri Jun 4 15:45:03 UTC 2010


Hi Chris,

this is the code. Sorry I did not realize I should post the code:


my @params = ( program  => 'blastp',
            database => '/Users/XXX/Desktop/genomes/BAA/all.faa');

my $blast_obj = Bio::Tools::Run::StandAloneBlast->new(@params);


my $in= $ARGV[0];


print  "Query_name\t". "Hit name\t" ."Hit description\t" ."Hit length\t" .
"percent_identity\t" . "start('hit')\t" ."end('hit')\t" ."start('query')\t"
.
"start('query')\n";




my $seqio_obj = Bio::SeqIO->new(-file=> '2cs2151.fasta', '-format' =>
'Fasta');

#print $seq_in->name."\n";



my    @seq_array =();

my $seqc=1;

my $blast_report;

my @reports;

my @hits;


    while( my $input = $seqio_obj->next_seq() ) {
#
     $blast_report = $blast_obj->blastall($input);

     push(@reports,$blast_report);

     }


foreach(@reports){

#print $_->next_result->num_hits."xxx\n";

while(my $result=$_->next_result){
 #if($result->num_hits){


   my @stats =  $result->available_statistics;
   my @params = $result->available_parameters;

  while(my $hit= $result->next_hit){

   while ( my $hsp = $hit->next_hsp ) {
      if ($hsp->percent_identity >=90){


      my $id =         $hit->matches('id');
      my $cons =       $hit->matches('cons');
      my @accs =       $hit->each_accession_number;
      my @qidentical = $hit->seq_inds('query','identical');
      my @qconserved = $hit->seq_inds('query','conserved');
      my @hidentical = $hit->seq_inds('hit','identical');
      my @hconserved = $hit->seq_inds('hit','conserved');
#loop 2b stuff removed from here

  print $result->query_name. "\t";

 my $name= fix_name($hit->name);
  print $name . "\t";

      #print "Hit\taccession\t" .           $hit->accession . "\n";

if($hit->description=~/.+(.ESA.+\d+)\s*\[Cronobacter sakazakii.+/){
print $1." [cs894]"."\t";
}elsif($hit->description=~/(.+)\s*\[Cronobacter sakazakii.+/){
print $1." [cs894]"."\t";
}elsif($hit->description=~/(.+\w)\s*\[.+turicensis.+/){
print $1." [ct3032]"."\t";
}else{
print  $hit->description . "\t";
}

      print $hit->length . "\t";



     my @hrange =  $hsp->range('hit');
     my @qrange =  $hsp->range('query');
     my $aln =     $hsp->get_aln;
     my $alnIO = Bio::AlignIO->new(-format=>"clustalw");


     my $p=sprintf("%.1f", $hsp->percent_identity);
     print $p. "\t";
#     print "HSP\tstrand()\t" .         $hsp->strand() . "\n";
     print $hsp->start('hit') . "\t";
      print $hsp->end('hit') . "\t";
     print $hsp->start('query') . "\t";
     print $hsp->end('query') . "\n";
#     print "HSP\talignment\n";
    # print $alnIO->write_aln($aln);
     }
      }
   }

#}

}


}


On Fri, Jun 4, 2010 at 11:10 AM, Chris Fields <cjfields at illinois.edu> wrote:

> You should post code examples that cause the problem (the more concise the
> better).  My guess is you are somehow caching the files by persisting the
> SearchIO instances; files for these are normally cleaned up when the
> SearchIO instance is destroyed.
>
> If needed you can also call cleanup() from the standaloneblast instance to
> clean them up manually.
>
> chris
>
>
> On Jun 4, 2010, at 6:23 AM, Gopal wrote:
>
> > Hi,
> >
> > I am trying to run standalone blast and parse the files, both using
> BioPerl.
> >
> > When running a moderately big file, I keep getting this message:
> >
> > "Error in tempfile() using
> > /var/folders/lJ/lJxoSpu4FYukooFDUoeLWIJTR5g/-Tmp-/XXXXXXXXXX: Could not
> > create temp file
> > /var/folders/lJ/lJxoSpu4FYukooFDUoeLWIJTR5g/-Tmp-/RLI8KU9LSL: Too many
> open
> > files at /Library/Perl/5.10.0/Bio/Root/IO.pm line 719"
> >
> > I am running on Mac OS Snow Leapord and my Perl, BioPerl are current.
> >
> > please help me how to fix this problem,
> >
> > thanks,
> >
> > -gopal
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
>


-- 
Gopal Gopinathrao, PhD
Bioinformaticist / Biologist
CFSAN, US FDA
www.patrn.net/patrn
gopal.gopinathrao at fda.hhs.gov
P: 301-210-7881



More information about the Bioperl-l mailing list