I think that 1-based indexing was chosen because that's what's used in genome databases like GenBank. Thus gene offsets from outside data sources can be used directly without subtracting 1. That said, almost every time I write code using sequences I get off-by-one errors, so I understand your frustration. We should definitely improve documentation so that every method that takes 1-based indexes are clearly marked.
-Spencer On Thu, Oct 6, 2011 at 03:37, Hannes Brandstätter-Müller < [email protected]> wrote: > Thanks, I'll try to add what I find out. It's a wiki after all. I'll > just ask the mailing list if things are unclear before I add stuff to > the wiki. > > One thing that bugged me just now, and since I can't find documentation on > it: > > Why is a sequence indexed by 1-(n+1) instead of 0-n? That's rather > un-java-like, especially since you just get an OutOfBoundsException, > and the range is not specified in the javadoc, or I could not find it > easily in the complex class hierarchy. > > Hannes > > 2011/10/6 Scooter Willis <[email protected]>: > > Hannes > > > > As you can tell we need to improve the cookbook examples. Since you are > > going through that process would welcome any contributions you can make. > > > > Thanks > > > > Scooter > > > > On 10/6/11 4:07 AM, "Hannes Brandstätter-Müller" <[email protected] > > > > wrote: > > > >>On Thu, Oct 6, 2011 at 09:32, Hannes Brandstätter-Müller > >><[email protected]> wrote: > >>> Hi again! > >>> What I ran into now is that most of the meta-information of a Sequence > >>> seems to get lost during the MSA step. > >> > >>Okay, that was something caused by following another cookbook script > >>(that, unfortunately, has absolutely no docs or comments) - I found > >>the getOriginalSequence() method, can work with that. Thanks! > >> > >>Hannes > >> > >>_______________________________________________ > >>Biojava-l mailing list - [email protected] > >>http://lists.open-bio.org/mailman/listinfo/biojava-l > > > > > > _______________________________________________ > Biojava-l mailing list - [email protected] > http://lists.open-bio.org/mailman/listinfo/biojava-l > _______________________________________________ Biojava-l mailing list - [email protected] http://lists.open-bio.org/mailman/listinfo/biojava-l
