+ @Test(groups = { "Functional" })
+ public void testIsNucleotide()
+ {
+ assertTrue(Comparison.isNucleotide('a'));
+ assertTrue(Comparison.isNucleotide('A'));
+ assertTrue(Comparison.isNucleotide('c'));
+ assertTrue(Comparison.isNucleotide('C'));
+ assertTrue(Comparison.isNucleotide('g'));
+ assertTrue(Comparison.isNucleotide('G'));
+ assertTrue(Comparison.isNucleotide('t'));
+ assertTrue(Comparison.isNucleotide('T'));
+ assertTrue(Comparison.isNucleotide('u'));
+ assertTrue(Comparison.isNucleotide('U'));
+ assertFalse(Comparison.isNucleotide('-'));
+ assertFalse(Comparison.isNucleotide('P'));
+ }
+
+ /**
+ * Test the percentage identity calculation for two sequences
+ */
+ @Test(groups = { "Functional" })
+ public void testPID_ungappedOnly()
+ {
+ // 5 identical, 2 gap-gap, 2 gap-residue, 1 mismatch
+ // the extra length of seq1 is ignored
+ String seq1 = "a--b-cdefhr";
+ String seq2 = "a---bcdefg";
+ int length = seq1.length();
+
+ /*
+ * As currently coded, 'ungappedOnly' ignores gap-residue but counts
+ * gap-gap. Is this a bug - should gap-gap also be ignored, giving a PID of
+ * 5/6?
+ *
+ * Note also there is no variant of the calculation that penalises
+ * gap-residue i.e. counts it as a mismatch. This would give a score of 5/8
+ * (if we ignore gap-gap) or 5/10 (if we count gap-gap as a match).
+ */