JAL-2110 additional tests for setDatasetSequence, javadoc for isProtein
[jalview.git] / src / jalview / datamodel / Sequence.java
index 29d114d..68c8c50 100755 (executable)
@@ -22,6 +22,7 @@ package jalview.datamodel;
 
 import jalview.analysis.AlignSeq;
 import jalview.api.DBRefEntryI;
+import jalview.util.Comparison;
 import jalview.util.DBRefUtils;
 import jalview.util.MapList;
 import jalview.util.StringUtils;
@@ -1013,12 +1014,12 @@ public class Sequence extends ASequence implements SequenceI
   {
     if (seq == this)
     {
-      throw new Error(
+      throw new IllegalArgumentException(
               "Implementation Error: self reference passed to SequenceI.setDatasetSequence");
     }
     if (seq != null && seq.getDatasetSequence() != null)
     {
-      throw new Error(
+      throw new IllegalArgumentException(
               "Implementation error: cascading dataset sequences are not allowed.");
     }
     datasetSequence = seq;
@@ -1117,6 +1118,10 @@ public class Sequence extends ASequence implements SequenceI
 
   private long _seqhash = 0;
 
+  /**
+   * Answers false if the sequence is more than 85% nucleotide (ACGTU), else
+   * true
+   */
   @Override
   public boolean isProtein()
   {
@@ -1127,7 +1132,7 @@ public class Sequence extends ASequence implements SequenceI
     if (_seqhash != sequence.hashCode())
     {
       _seqhash = sequence.hashCode();
-      _isNa=jalview.util.Comparison.isNucleotide(new SequenceI[] { this });
+      _isNa = Comparison.isNucleotide(this);
     }
     return !_isNa;
   };