[Biojava-l] Mutable sequence dbs

Matthew Pocock mrp@sanger.ac.uk
Thu, 10 Aug 2000 14:10:51 +0100

Thanks Hilmar,

hilmar.lapp@pharma.novartis.com wrote:

> I am enclosing the interface MutableSequenceDB with which I'm happy so far,
> and in addition a convenience class SequenceIteratorDB implementing this
> interface, which lets you view one or multiple SequenceIterator(s) as a
> database.

Hilmar's mutability methods are:

    public String addSequence(Sequence seq) throws BioException;
    public void removeSequence(String id);

These look good. Should they go into MutableSequenceDB, or directly into SequenceDB? I
have a bias towards adding them directly to SequenceDB, but here are the pros and cons as
I see them.

Reasons for explicit Mutable interface:
1) you can programmaticaly find out if a database can be modified, and act accordingly

2) it keeps the SequenceDB interface light-weight

Reasons for making SequenceDB mutable:
1) you can treat every sequence db object equaly

2) the add/remove methods will have to throw exceptions if you do stupid things anyway,
so immutable sequence dbs could just complain all the time without imposing additional
try/catch blocks.

3) some databases are immutable (embl), some are always mutable (your favorite sequences
that day) and some are transiently immutable (a sequence db that is being used at that
instant to train an HMM). If we allow all dbs to expose a mutable interface but complain
if they can't be edited at that time, then we get a much finer-grain control

4) it sort of follows the Collections way of doing things - immutable views possible etc.


>      Hilmar