return new Sequence(this);
}
+ private boolean _isNa;
+
+ private long _seqhash = 0;
+
+ @Override
+ public boolean isProtein()
+ {
+ if (datasetSequence != null)
+ {
+ return datasetSequence.isProtein();
+ }
+ if (_seqhash != sequence.hashCode())
+ {
+ _seqhash = sequence.hashCode();
+ _isNa=jalview.util.Comparison.isNucleotide(new SequenceI[] { this });
+ }
+ return !_isNa;
+ };
+
/*
* (non-Javadoc)
*
public int[] findPositionMap();
/**
+ *
+ * @return true if sequence is composed of amino acid characters
+ */
+ public boolean isProtein();
+
+ /**
* Delete a range of aligned sequence columns, creating a new dataset sequence
* if necessary and adjusting start and end positions accordingly.
*
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());
+ }
@Test(groups = { "Functional" })
public void testGetAnnotation()
{
}
/**
+ * 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" })