assertFalse(new Sequence("prot", "ACGTACGTACGTNNNNNNNN").isProtein());
// test RNA with X
assertFalse(new Sequence("prot", "ACGUACGUACGUACTGACAXX").isProtein());
+ assertFalse(new Sequence("prot", "ACGUACGUACGUXXXXXXXXX").isProtein());
assertFalse(new Sequence("prot", "ACGUACGUACGUNNNNNNNNN").isProtein());
}
derived.getDatasetSequence().getSequenceAsString());
}
+ /**
+ * test that creating a copy of an existing sequence with dataset sequence and
+ * associated contact matrix yields annotation associated with the same
+ * contact matrix in the copy
+ */
+ @Test(groups = { "Functional" })
+ public void testCopyPasteStyleDerivesequence_withcontactMatrixAnn()
+ {
+ SequenceI seq1 = new Sequence("seq1", "ACDACDACD");
+ seq1.createDatasetSequence();
+ ContactMatrixI cm = new SeqDistanceContactMatrix(seq1.getLength());
+ // addContactList needs to return annotation addable to the sequence
+ // reference it was called from
+ AlignmentAnnotation aann = seq1.addContactList(cm);
+ assertTrue(aann.sequenceRef == seq1);
+ assertEquals(1, seq1.getAnnotation().length);
+ assertNotNull(seq1.getContactListFor(seq1.getAnnotation()[0], 1));
+
+ SequenceI seq_derived = seq1.deriveSequence();
+ assertEquals(1, seq_derived.getAnnotation().length);
+ assertTrue(cm == seq_derived
+ .getContactMatrixFor(seq_derived.getAnnotation()[0]));
+ assertNotNull(seq_derived
+ .getContactListFor(seq_derived.getAnnotation()[0], 1));
+
+ // copy paste actually uses the copy constructor .. so
+
+ SequenceI seq_copied = new Sequence((Sequence) seq_derived);
+ assertEquals(1, seq_copied.getAnnotation().length);
+ assertTrue(cm == seq_copied
+ .getContactMatrixFor(seq_copied.getAnnotation()[0]));
+ assertNotNull(
+ seq_copied.getContactListFor(seq_copied.getAnnotation()[0], 1));
+
+ }
+
@Test(groups = { "Functional" })
public void testCopyConstructor_noDataset()
{
{
Sequence origSeq = new Sequence("MYSEQ", "THISISASEQ");
Sequence toSeq = new Sequence("MYSEQ", "THISISASEQ");
+ origSeq.setDescription("DESCRIPTION");
origSeq.addDBRef(new DBRefEntry("UNIPROT", "0", "Q12345", null, true));
+
toSeq.transferAnnotation(origSeq, null);
+ assertEquals("DESCRIPTION", toSeq.getDescription());
+ toSeq = new Sequence("MYSEQ", "THISISASEQ");
+ toSeq.setDescription("unchanged");
+ toSeq.transferAnnotation(origSeq, null);
+ assertEquals("unchanged", toSeq.getDescription());
+
assertTrue(toSeq.getDBRefs().size() == 1);
assertTrue(toSeq.getDBRefs().get(0).isCanonical());