[Biojava-l] IndexOutOfBounds Exception when performing Pairwise Alignment

Hannes Brandstätter-Müller biojava at hannes.oib.com
Tue Dec 6 10:39:39 UTC 2011


another update: that most recent exception was caused by a reference
sequence consisting only of "NNNN" - looks like something that should
be handled more gracefully to me :)

Hannes

On Tue, Dec 6, 2011 at 09:59, Hannes Brandstätter-Müller
<biojava at hannes.oib.com> wrote:
> Hah, I got some not-null results:
>
>
> On Tue, Dec 6, 2011 at 09:20, Hannes Brandstätter-Müller
> <biojava at hannes.oib.com> wrote:
>>
>> public void testPSA() {
>>        String targetSeq =
>> "CACGTTTCTTGTGGCAGCTTAAGTTTGAATGTCATTTCTTCAATGGGACGGA"
>>                +
>> "GCGGGTGCGGTTGCTGGAAAGATGCATCTATAACCAAGAGGAGTCCGTGCGCTTCGACAGC"
>>                +
>> "GACGTGGGGGAGTACCGGGCGGTGACGGAGCTGGGGCGGCCTGATGCCGAGTACTGGAACA"
>>                +
>> "GCCAGAAGGACCTCCTGGAGCAGAGGCGGGCCGCGGTGGACACCTACTGCAGACACAACTA"
>>                + "CGGGGTTGGTGAGAGCTTCACAGTGCAGCGGCGAG";
>>        DNASequence target = new DNASequence(targetSeq,
>> AmbiguityDNACompoundSet.getDNACompoundSet());
>>        String querySeq =
>> "ACGAGTGCGTGTTTTCCCGCCTGGTCCCCAGGCCCCCTTTCCGTCCTCAGGAA"
>>                +
>> "GACAGAGGAGGAGCCCCTCGGGCTGCAGGTGGTGGGCGTTGCGGCGGCGGCCGGTTAAGGT"
>>                +
>> "TCCCAGTGCCCGCACCCGGCCCACGGGAGCCCCGGACTGGCGGCGTCACTGTCAGTGTCTT"
>>                +
>> "CTCAGGAGGCCGCCTGTGTGACTGGATCGTTCGTGTCCCCACAGCACGTTTCTTGGAGTAC"
>>                +
>> "TCTACGTCTGAGTGTCATTTCTTCAATGGGACGGAGCGGGTGCGGTTCCTGGACAGATACT"
>>                +
>> "TCCATAACCAGGAGGAGAACGTGCGCTTCGACAGCGACGTGGGGGAGTTCCGGGCGGTGAC"
>>                +
>> "GGAGCTGGGGCGGCCTGATGCCGAGTACTGGAACAGCCAGAAGGACATCCTGGAAGACGAG"
>>                +
>> "CGGGCCGCGGTGGACACCTACTGCAGACACAACTACGGGGTTGTGAGAGCTTCACCGTGCA"
>>                + "GCGGCGAGACGCACTCGT";
>>        DNASequence query = new DNASequence(querySeq);
>
> query.setCompoundSet(AmbiguityDNACompoundSet.getDNACompoundSet()); //
> inserting that helps.
>
>>        SubstitutionMatrix<NucleotideCompound> matrix =
>> SubstitutionMatrixHelper.getNuc4_4();
>>        SequencePair<DNASequence, NucleotideCompound> psa =
>> Alignments.getPairwiseAlignment(query, target,
>> PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(), matrix);
>>        assertNotNull(psa);
>>    }
>
> But when I try something similar in my production code, I get an
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 again
>
> dnaSequence.setCompoundSet(AmbiguityDNACompoundSet.getDNACompoundSet());
> // If I remove this line, the exception is gone again, but I get NULL
> result.
> psa = Alignments.getPairwiseAlignment(dnaSequence, target,
> PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(), matrix);
>
> the dnaSequence in that case is something that is passed to this
> method, and is a sequence generated by a fasta reader - should have no
> ambiguity in there, just plain ACGT. It has a plain DNACompoundSet
> too.
>
> Hannes
>




More information about the Biojava-l mailing list