Re: IndexOutOfBounds Exception when performing Pairwise Alignment

Hannes Brandstätter-Müller <[email protected]>
Newsgroups gmane.comp.java.bio.general
Message-ID <CAPXi2mm7=OggPKu-SVK-4-cJkM0jVLzv-8Gd4Y3EugWGhqsVpQ@mail.gmail.com>
Hah, I got some not-null results:


On Tue, Dec 6, 2011 at 09:20, Hannes Brandstätter-Müller
<[email protected]> 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

_______________________________________________
Biojava-l mailing list  -  [email protected]
http://lists.open-bio.org/mailman/listinfo/biojava-l
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.