[Bioperl-l] unsupported close() in SeqIO
Jason Stajich
jason@cgt.mc.duke.edu
Wed, 2 Oct 2002 11:27:47 -0400 (EDT)
On Wed, 2 Oct 2002, T.D. Houfek wrote:
> Hi all,
>
> Recently I noticed that if I wrote out a FASTA sequence file using
> SeqIO and then read it back in using another SeqIO object, the last
> two sequences were dropped on input (all sequences made it to the
> file I wrote to, but two were missing after I loaded the new object).
> I found that calling $out->close() before the new load fixed the
> problem. However, the SeqIO perldocs say that close() is unsupported.
> Does anyone know if there is any reason to fear using this method, and/or
> whether there is a better way to do things? I'm presently using BioPerl
> 1.0.
We've already fixed this in the main-trunk code so that by default all
output is flushed on each seq write (for those who want the minute perf
burst, they can disable this by setting a flag).
You can just do $seqio = undef; to insure the destructor is called.
However,
The docs are related to the filehandle creation not the object method. see
below -- $seqio->close() IS supported as well (this is inherited from
Bio::Root::IO).
--DOCS-BEGIN--
head2 Bio::SeqIO-E<gt>newFh()
$fh = Bio::SeqIO->newFh(-fh => \*FILEHANDLE, -format=>$format);
$fh = Bio::SeqIO->newFh(-format => $format);
# etc.
This constructor behaves like new(), but returns a tied filehandle
rather than a Bio::SeqIO object. You can read sequences from this
object using the familiar E<lt>E<gt> operator, and write to it using
print(). The usual array and $_ semantics work. For example, you can
read all sequence objects into an array like this:
@sequences = <$fh>;
Other operations, such as read(), sysread(), write(), close(), and
printf() are not supported.
>
> Cheers,
>
> T.D. Houfek
>
> system administrator
> Fungal Genomics Laboratory
> Center for Integrated Fungal Research (CIFR)
> North Carolina State University
> ph: (919)513-0025 e: tdhoufek@unity.ncsu.edu
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>
--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu