[Biojava-l] IndexOutOfBounds Exception when performing Pairwise Alignment

Hannes Brandstätter-Müller biojava at hannes.oib.com
Mon Dec 5 07:42:59 UTC 2011


Yes, that fixed that exception.

Now, I'm getting null return value - must be still something wrong in
the parameters...

SubstitutionMatrix<NucleotideCompound> matrix =
SubstitutionMatrixHelper.getNuc4_4();
Alignments.getPairwiseAlignment(dnaSequence, target,
PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(), matrix);

Where should I start looking for that?

Is there a simple way to align (or score, don't need the full
alignment) a single DNA sequence against a List of sequences? I only
found the "How to concurrently create a PSA for each pair in a
sequence list in BioJava" cookbook entry, but that calculates a bunch
of (for me) useless PSAs. would it be better to perform a blast search
(custom "library" to search against) for that?

Thanks,
Hannes

On Fri, Dec 2, 2011 at 23:04, Andreas Prlic <andreas at sdsc.edu> wrote:
> Hi Hannes,
>
> Did you make sure to use the correct substitution matrix for the
> alignment? You need substitution scores for all nucleotides in your
> sequence to be present in the matrix...
>
> Andreas
>
> On Thu, Dec 1, 2011 at 4:59 AM, Hannes Brandstätter-Müller
> <biojava at hannes.oib.com> wrote:
>> What am I doing wrong? I get:
>>
>> Exception in thread "main" java.lang.IndexOutOfBoundsException: Index:
>> 0, Size: 0
>>        at java.util.ArrayList.RangeCheck(ArrayList.java:547)
>>        at java.util.ArrayList.get(ArrayList.java:322)
>>        at org.biojava3.alignment.SimpleAlignedSequence.setLocation(SimpleAlignedSequence.java:362)
>>        at org.biojava3.alignment.SimpleAlignedSequence.<init>(SimpleAlignedSequence.java:88)
>>        at org.biojava3.alignment.SimpleProfile.<init>(SimpleProfile.java:118)
>>        at org.biojava3.alignment.SimpleSequencePair.<init>(SimpleSequencePair.java:86)
>>        at org.biojava3.alignment.SmithWaterman.setProfile(SmithWaterman.java:71)
>>        at org.biojava3.alignment.template.AbstractMatrixAligner.align(AbstractMatrixAligner.java:342)
>>        at org.biojava3.alignment.template.AbstractPairwiseSequenceAligner.getPair(AbstractPairwiseSequenceAligner.java:112)
>>        at org.biojava3.alignment.Alignments.getPairwiseAlignment(Alignments.java:208)
>>
>> when calling Alignments.getPairwiseAlignment(dnaSequence, target,
>> PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(), matrix);
>>
>> where matrix = new SimpleSubstitutionMatrix<NucleotideCompound>();,
>> sequence and target are both DNASequence
>>
>> Possible causes I can think of: target might contain IUB-Codes (not
>> just ACGTU, but also RYKM...)
>>
>> Hannes
>> _______________________________________________
>> Biojava-l mailing list  -  Biojava-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/biojava-l
>




More information about the Biojava-l mailing list