assertEquals("Gap interval 2 end wrong", 8, gapInt.get(1)[1]);
}
+ @Test(groups = ("Functional"))
+ public void testIsProtein()
+ {
+ // test Protein
+ assertTrue(new Sequence("prot","ASDFASDFASDF").isProtein());
+ // test DNA
+ assertFalse(new Sequence("prot","ACGTACGTACGT").isProtein());
+ // test RNA
+ SequenceI sq = new Sequence("prot","ACGUACGUACGU");
+ assertFalse(sq.isProtein());
+ // change sequence, should trigger an update of cached result
+ sq.setSequence("ASDFASDFADSF");
+ assertTrue(sq.isProtein());
+ /*
+ * in situ change of sequence doesn't change hashcode :-O
+ * (sequence should not expose internal implementation)
+ */
+ for (int i = 0; i < sq.getSequence().length; i++)
+ {
+ sq.getSequence()[i] = "acgtu".charAt(i % 5);
+ }
+ assertTrue(sq.isProtein()); // but it isn't
+ }
+
@Test(groups = { "Functional" })
public void testGetAnnotation()
{
{
AlignmentAnnotation ann1 = addAnnotation("label1", "desc1", "calcId1",
1f);
- AlignmentAnnotation ann2 = addAnnotation("label2", "desc2", "calcId2",
- 1f);
+ addAnnotation("label2", "desc2", "calcId2", 1f);
AlignmentAnnotation ann3 = addAnnotation("label1", "desc3", "calcId3",
1f);
AlignmentAnnotation[] anns = seq.getAnnotation("label1");
@Test(groups = { "Functional" })
public void testGetAlignmentAnnotations_forCalcIdAndLabel()
{
- AlignmentAnnotation ann1 = addAnnotation("label1", "desc1", "calcId1",
- 1f);
+ addAnnotation("label1", "desc1", "calcId1", 1f);
AlignmentAnnotation ann2 = addAnnotation("label2", "desc2", "calcId2",
1f);
- AlignmentAnnotation ann3 = addAnnotation("label2", "desc3", "calcId3",
- 1f);
+ addAnnotation("label2", "desc3", "calcId3", 1f);
AlignmentAnnotation ann4 = addAnnotation("label2", "desc3", "calcId2",
1f);
- AlignmentAnnotation ann5 = addAnnotation("label5", "desc3", null, 1f);
- AlignmentAnnotation ann6 = addAnnotation(null, "desc3", "calcId3", 1f);
+ addAnnotation("label5", "desc3", null, 1f);
+ addAnnotation(null, "desc3", "calcId3", 1f);
+
List<AlignmentAnnotation> anns = seq.getAlignmentAnnotations("calcId2",
"label2");
assertEquals(2, anns.size());
}
/**
+ * test createDatasetSequence behaves to doc
+ */
+ @Test(groups = { "Functional" })
+ public void testCreateDatasetSequence()
+ {
+ SequenceI sq = new Sequence("my","ASDASD");
+ assertNull(sq.getDatasetSequence());
+ SequenceI rds = sq.createDatasetSequence();
+ assertNotNull(rds);
+ assertNull(rds.getDatasetSequence());
+ assertEquals(sq.getDatasetSequence(), rds);
+ }
+
+ /**
* Test for deriveSequence applied to a sequence with a dataset
*/
@Test(groups = { "Functional" })