[Biojava-l] Location Objects
Nathan S. Haigh
n.haigh at sheffield.ac.uk
Wed Aug 9 13:20:17 UTC 2006
I apologies for the waffle but i'm a bit stuck with Location objects,
and in particular if a Location object can be empty and if there are
methods for creating, checking and testing for empty Locations.
I'm writing some classes which use Location objects.
It seems to me that it should be possible to create an empty Location
object and also test if a Location object is empty. In addition, it
would be good if the union method could handle these empty Location objects.
What i would like to do, is to iterate over columns in an alignment and
determine in that position should be added to the Location object.
Ideally, what i would like to do is to create an empty Location object
and then use the union method to add positions as i iterate over the
alignment columns. In addition, i'm writing a method that takes an
inverse of a Location given an alignment length using the exclude method.
What i'm currently having to do is create a dummy Location object with
position 0,0 - which doesn't make much sense since they should be +ve
integers shouldn't they? Then while itereating over positions in the
alignment, i use LocationTools.union with the dummy Location and a
PointLocation object to add the current position to the Location object
which is being built.
The main problem i have is when i have an alignment of length 20 and a
Location object coving all positions from 1-20 and i want to invert this
Location object. It make sense to return an "empty" Location object, but
i'm using a Location object with coordinates 0,0 for my purposes. At the
moment my JUnit test for inverting the Location object shown above tests
for a Location object with coordinates 0,0:
Location inv = invLocation(LocationTools.makeLocation(1, 17), 17);
assertEquals(LocationTools.makeLocation(0,0), inv);
however i get an error like:
junit.framework.AssertionFailedError: expected:<0> but was:<{}>
Therefore, there must be a way to represent an empty Location object,
but it may not be fully implemented. If i use getMin on this inverted
Location (which should be empty) i get a value of 2147483647 with no errors.
Thanks
Nathan
<http://www.mozilla.org/products/thunderbird/>
More information about the Biojava-l
mailing list