[BioPython] RecordFile
Ramu Chenna
chenna@embl-heidelberg.de
Wed, 27 Jun 2001 10:10:33 +0200
>
> The implementation is based on a state machine. and assumes sequential
> access.
> RecordRead.read provides the same interface as read. It has an optional
> parameter, size.
>
> RecordFile.read, with no parameters, searches for the next record and
> returns
> it in its entirety. A subsequent call returns an empty string to signal the
> end of the record. However, the next call will advance to the next record
> and return it, it it exists. Otherwise RecordFile.read will return a second
> empty string.
the idea is nice, start and end tag is a fasterway to fetch a record from
flat file.
subsequent call should return the next record and empty string should be
used to mark for end of file. Something like
while 1:
e = db.nextrecord()
if not e:
break
Otherwise making two calls to fetch an entry, i think, unnecessary (pardon
me if i am wrong....)
I did something like this, have a look at biopython's script central under
PySAT.
Ramu
>
> If a calling program passes a size parameter RecordFile will check its own
> position with respect to record data. If it just past the end of record, it
> will return an empty string. If it is between records it will advance to
> the next record and retuurn the specified number of bytes from the record,
> if they are available. Otherwise, it will return all the data remaining in
> the current record. If it is already within the record, RecordFile.read
> will return data from the current position.
>
> Cayte
>
>
> _______________________________________________
> BioPython mailing list - BioPython@biopython.org
> http://biopython.org/mailman/listinfo/biopython
>