[Biojava-l] Bug in assembly behaviour

David Huen David Huen <smh1008@cus.cam.ac.uk>
Sat, 5 Jan 2002 15:46:44 +0000 (GMT)


I have recently updated my copy of the biojava source from CVS after a
long code freeze while developing some DAS code and may have detected a
problem. There appears to be a fatal bug that arises from a change in the
interaction between AssembledSymbolList and SimpleAssembly.

>From SimpleAssembly.createFeature:-
        if (f instanceof ComponentFeature) {
            ComponentFeature cf = (ComponentFeature) f;
            Location loc = cf.getLocation();
            if (loc.getMax() > assembly.length()) {
                assembly.setLength(loc.getMax());
            }
            assembly.putComponent(cf);
        }

SimpleAssembly extends the AssembledSymbolList bounds when required.

>From AssembledSequenceList:-
    public int length() {
      if(autoLength) {
        Location last = (Location) componentList.get(componentList.size()
- 1);
        return last.getMax();
      } else {
        return length;
      }
    }

However, when adding the first ComponentFeature to a SimpleAssembly
created with the autolength constructor, that first call to
assembly.length() causes a componentList.get() on an empty componentList
and the code crashes and burns.

The das-client is fatally affected by this change too.

I have changed AssembledSequenceList.length() to return 0 on an empty list
in my own copy.  Is this value compatible with other existing code?  if
so, I will commit my change to CVS.

The other issue is whether SimpleAssembly should be handling the
extension of the AssembledSequenceList any further.  Will anything break
if we just let the AssembledSequenceList do it itself?

Regards,
David Huen