[Bioperl-l] Root::IO tempfile error

Marc Logghe Marc.Logghe at devgen.com
Wed Mar 3 03:23:33 EST 2004


Hi Charles,
You have to pass the UNLINK argument, saying you don't want to delete the file as soon as the filehandle is closed. By default it is 1.
This should work:
my ($tfh,$tempfile) = $io->tempfile(-DIR => TEMPOUTDIR, -UNLINK => 0);

HTH,
Marc

> -----Original Message-----
> From: Charles Hauser [mailto:chauser at duke.edu]
> Sent: woensdag 3 maart 2004 1:13
> To: BioPerl-List
> Subject: [Bioperl-l] Root::IO tempfile error
> 
> 
> All,
> 
> I'm working on a web blast script and it appears that 
> Bio::SeqIO is not
> writing the temp file for the input sequence.
> (I'm using CVS version of bioperl updated this am)
> 
> If I output $tempfile, Bio::Root::IO appears to be creating it:
> 
> 	/scratch/B3ltaJkxr4
> 
> but if I look in /scratch nada, and if I let the script execute blast
> and attempt to open the results($tempfile.bls.txt) I get the server
> error below.
> 
> ideas?
> 
> thanks Charles
> 
> 
> relevant snippet of code:
> 
>     use constant TEMPOUTDIR  => '/scratch';
> 
>     my $io = new Bio::Root::IO;
>     my ($tfh,$tempfile) = $io->tempfile(-DIR => TEMPOUTDIR);
>     my $out = new Bio::SeqIO(-fh => $tfh, -format => 'fasta');
>     $out->write_seq($seq);
>     $out->close();
> 
>     [snip set up blast params  ]
> 
>     my $blastexe = "$prog -i $tempfile -o $tempfile.bls.txt 
> -d ".BLASTDIR."/$db E=$evalue $options";
>     `$blastexe`;
> 
>     my $parser = new Bio::SearchIO(-file   => "$tempfile.bls.txt",
> 				   -format => 'blast');
> 
> 
> 
> 
> ------------- EXCEPTION  -------------
> MSG: Could not open /scratch/B3ltaJkxr4.bls.txt: No such file 
> or directory
> STACK Bio::Root::IO::_initialize_io 
> /usr/local/src/bioperl/core/Bio/Root/IO.pm:273
> STACK Bio::Root::IO::new 
> /usr/local/src/bioperl/core/Bio/Root/IO.pm:213
> STACK Bio::SearchIO::new 
> /usr/local/src/bioperl/core/Bio/SearchIO.pm:135
> STACK Bio::SearchIO::new 
> /usr/local/src/bioperl/core/Bio/SearchIO.pm:167
> STACK toplevel /var/www/cgi-bin/BLAST/foo.pl:217
>  
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
> 



More information about the Bioperl-l mailing list