The javadoc on the interface indicates the intent to throw an IndexOutOfBoundsException with javadoc that indicates start with 1. Just needs to be better defined as a general rule in the method name getAlignedSequenceBioIndex(int index) as an example. BioIndex should be used in all methods where the desire is to use 1 instead of 0. We should also provide the equivalent getAlignedSequence(int index) with index = 0; If not this mistake will be made often.
Thanks Scooter On Fri, Jan 7, 2011 at 5:04 PM, Hara Dilley <[email protected]> wrote: > That would be very helpful! > > -----Original Message----- > From: Marco Valtas [mailto:[email protected]] > Sent: Friday, January 07, 2011 2:03 PM > To: Scooter Willis > Cc: Hara Dilley; [email protected] > Subject: Re: [Biojava-l] biojava3 getting the features from alignedsequence > > I think in such cases we could throw an exception. what I mean is that > having sequences positions counted from 1 and someone tries to fetch a > position from 0 a exception could be thrown telling that such index starts > at 1. For arrays and lists that not model a sequence will be better keep the > computer science convention. Any thoughts? > > Marco Valtas > Developer at ThoughtWorks > > Sent from my iPhone > > On 07/01/2011, at 17:51, Scooter Willis <[email protected]> wrote: > > > Hara > > > > Figured out the problem. Welcome to the world of biology indexes start at > 1 > > and computer science starts at 0. > > > > If you use 1 as your first index it will work. In the core module we > tried > > to make that clear by using BioIndex in the method name. I will see what > I > > can do about getting that added/changed in the alignment module. > > > > Thanks > > > > Scooter > > > > On Fri, Jan 7, 2011 at 12:20 PM, Hara Dilley <[email protected]> wrote: > > > >> Thanks Scooter, > >> > >> Below is the code of how I populate lst. Of course my real sequences are > >> different, but for this example it doesn’t matter. > >> > >> > >> > >> List<ProteinSequence> lst = *new* ArrayList<ProteinSequence>(); > >> > >> ProteinSequence s1 = *new* ProteinSequence(“SHALG”); > >> > >> ProteinSequence s2 = *new* ProteinSequence(“SWQVLG”); > >> > >> lst.add(s1); > >> > >> lst.add(s2); > >> > >> > >> > >> > >> > >> > >> > >> *From:* [email protected] [mailto:[email protected]] *On Behalf Of > *Scooter > >> Willis > >> *Sent:* Thursday, January 06, 2011 6:43 PM > >> *To:* Hara Dilley > >> *Cc:* [email protected] > >> *Subject:* Re: [Biojava-l] biojava3 getting the features from > >> alignedsequence > >> > >> > >> > >> Hara > >> > >> > >> > >> Can you provide more of the code you are using that shows how you are > >> loading the initial sequences. > >> > >> > >> > >> Thanks > >> > >> > >> Scooter > >> > >> > >> > >> On Thu, Jan 6, 2011 at 7:09 PM, Hara Dilley <[email protected]> wrote: > >> > >> Hi, > >> > >> I would like to align a set of sequences against a scaffold and get the > >> list of the modifications for each aligned sequence. > >> I am using biojava3 > >> I have tried to create a profile thinking that I can get the > >> AlignedSequences from it but that it appears to be null. > >> Here is part of my code: > >> > >> Profile<ProteinSequence, AminoAcidCompound> profile = > >> Alignments.getMultipleSequenceAlignment(lst); > >> Profile.getAlignedSequence(0); > >> > >> Can someone please point to an example for this or to the classes I have > to > >> use. > >> Thank you, > >> Hara > >> > >> > >> _______________________________________________ > >> 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
