[Biojava-l] Biocorba Demo and Iterator reset ?

Thomas Down td2@sanger.ac.uk
Tue, 16 Jan 2001 10:17:09 +0000

On Mon, Jan 15, 2001 at 04:52:42PM +0000, Arnaud Kerhornou wrote:
> Hi
> First just to let you know I ran the Biocorba demo with the new io
> proposal. With some modifications within the server code, it works fine.
> // SequenceFactory sFact = new SimpleSequenceFactory();
>     SequenceBuilderFactory sfact = new
> FastaDescriptionLineParser.Factory (SimpleSequenceBuilder.FACTORY);
> // ...
> // SequenceIterator seqI = new StreamReader(seqDBI, sFormat, rParser,
> sFact);
>     StreamReader seqI = new StreamReader (seqDBI, sFormat, rParser,
> sfact);

Cool.  Do you have CVS write access (Matthew's probably the
person to ask if you want an account), or would you like me to
check this in?

> And I'd like to know if it's possible to reset an Iterator Object to
> start again an iteration from the beginning ?

No, I don't think iterators should have this functionality.  An
iterator could encapsulate, for example, a stream of sequences
coming down an HTTP connection, and this can't be reset without
re-issuing the HTTP request.  In both BioJava and BioCorba, the
corrent pattern if you want multiple iterations is to got a
SequenceDB (PrimarySeqDB), and create new iterators as required.

[As an aside, I've been working  on the performance issues of
 the BioJava IndexedSequenceDB over the weekend, and I'll add a
 more efficient iterator() method to that.]