[Biojava-dev] SimpleFeatureHolder

Thomas Down thomas at derkholm.net
Wed Jun 4 09:40:48 EDT 2003


Once upon a time, Schreiber, Mark wrote:
> Hi -
> 
> Would it be possible for SimpleFeatureHolder to create new features from
> a template using createFeatures? Currently it doesn't override this
> method from AbstractFeatureHolder and throws a ChangeVetoException.

If you create a feature directly on a SimpleFeatureHolder,
what will its getSequence() method return?  How about
getParent()?

The double-binding between sequences and features is a rather
key feature of the BioJava object model, and was one of
the big constraints on what all the feature creation infrastructure
looks like.  I think changing it now would be a mistake.  If I
want to create a bunch of features without a real sequence,
I've found the following trick very helpful:

     Sequence seq = new SimpleSequence(
         new DummySymbolList(DNATools.getDNA(), length),
         name,
         name,
         Annotation.EMPTY_ANNOTATION
     );
     // create loads of features...

Longer term, this clearly is something that's worth fixing.  Back
when we were actively talking about BioJava2, one of the directions
of the discussion was to split Feature out into a generic part which
is a placeholder for the actual biological concept, plus one or
more `mapping' objects (I think the name SequenceRegion was used)
which bind a Feature into a particular location on a particular
sequence.

In this model, it shouldn't be a problem to have a second type of
Mapping object which doesn't have to point to a real sequence.
This solves lots of wrinkles -- for instance, it removes the need
to have a separate, dedicated object model for GFF entries :-).
But this is a big change to core interfaces, which is why it seems
like a BJ2 thing.

What do you think?

     Thomas.


More information about the biojava-dev mailing list