assertFalse(iter.hasNext());
}
+ /**
+ * Test method that returns annotations that match on reference sequence,
+ * label, or calcId.
+ */
+ @Test(groups = { "Functional" })
+ public void testFindAnnotations_bySeqLabelandorCalcId()
+ {
+ // TODO: finish testFindAnnotations_bySeqLabelandorCalcId test
+ /* Note - this is an incomplete test - need to check null or
+ * non-null [ matches, not matches ] behaviour for each of the three
+ * parameters..*/
+
+ // search for a single, unique calcId with wildcards on other params
+ Iterable<AlignmentAnnotation> anns = al.findAnnotations(null,
+ "CalcIdForD.melanogaster.2", null);
+ Iterator<AlignmentAnnotation> iter = anns.iterator();
+ assertTrue(iter.hasNext());
+ AlignmentAnnotation ann = iter.next();
+ assertEquals("D.melanogaster.2", ann.sequenceRef.getName());
+ assertFalse(iter.hasNext());
+
+ // save reference to test sequence reference parameter
+ SequenceI rseq = ann.sequenceRef;
+
+ // search for annotation associated with a single sequence
+ anns = al.findAnnotations(rseq, null, null);
+ iter = anns.iterator();
+ assertTrue(iter.hasNext());
+ ann = iter.next();
+ assertEquals("D.melanogaster.2", ann.sequenceRef.getName());
+ assertFalse(iter.hasNext());
+
+ // search for annotation with a non-existant calcId
+ anns = al.findAnnotations(null, "CalcIdForD.melanogaster.?", null);
+ iter = anns.iterator();
+ assertFalse(iter.hasNext());
+
+ // search for annotation with a particular label - expect three
+ anns = al.findAnnotations(null, null, "Secondary Structure");
+ iter = anns.iterator();
+ assertTrue(iter.hasNext());
+ iter.next();
+ assertTrue(iter.hasNext());
+ iter.next();
+ assertTrue(iter.hasNext());
+ iter.next();
+ // third found.. so
+ assertFalse(iter.hasNext());
+
+ // null on all parameters == find all annotations
+ anns = al.findAnnotations(null, null, null);
+ iter = anns.iterator();
+ int n = al.getAlignmentAnnotation().length;
+ while (iter.hasNext())
+ {
+ n--;
+ iter.next();
+ }
+ assertTrue("Found " + n + " fewer annotations from search.", n == 0);
+ }
+
@Test(groups = { "Functional" })
public void testDeleteAllAnnotations_includingAutocalculated()
{
AlignmentI alignment = new Alignment(new SequenceI[] { seq });
alignment.setDataset(alignment);
}
+
+ @Test(groups = "Functional")
+ public void testAppend()
+ {
+ SequenceI seq = new Sequence("seq1", "FRMLPSRT-A--L-");
+ AlignmentI alignment = new Alignment(new SequenceI[] { seq });
+ alignment.setGapCharacter('-');
+ SequenceI seq2 = new Sequence("seq1", "KP..L.FQII.");
+ AlignmentI alignment2 = new Alignment(new SequenceI[] { seq2 });
+ alignment2.setGapCharacter('.');
+
+ alignment.append(alignment2);
+
+ assertEquals('-', alignment.getGapCharacter());
+ assertSame(seq, alignment.getSequenceAt(0));
+ assertEquals("KP--L-FQII-", alignment.getSequenceAt(1)
+ .getSequenceAsString());
+
+ // todo test coverage for annotations, mappings, groups,
+ // hidden sequences, properties
+ }
}