Merge branch 'mmw/bug/JAL-4241-annotation-alignment-fix-slivka' into development...
[jalview.git] / src / jalview / datamodel / SequenceI.java
index a1b2683..82575ec 100755 (executable)
@@ -51,7 +51,6 @@ public interface SequenceI extends ASequenceI
   public HiddenMarkovModel getHMM();
 
   public void setHMM(HiddenMarkovModel hmm);
-
   /**
    * Get the display name
    */
@@ -102,6 +101,14 @@ public interface SequenceI extends ASequenceI
   public int getLength();
 
   /**
+   * Replace the sequence with the given characters
+   * 
+   * @param sequence
+   *          new sequence characters
+   */
+  public void setSequence(char[] sequence);
+
+  /**
    * Replace the sequence with the given string
    * 
    * @param sequence
@@ -397,6 +404,24 @@ public interface SequenceI extends ASequenceI
   public SequenceI getDatasetSequence();
 
   /**
+   * Returns the top grandparent in the dataset sequences hierarchy
+   * or null if there is no dataset associated with this sequence.
+   */
+  public default SequenceI getRootDatasetSequence()
+  {
+    if (getDatasetSequence() == null)
+    {
+      return null;
+    }
+    var sequence = getDatasetSequence();
+    while (sequence.getDatasetSequence() != null)
+    {
+      sequence = sequence.getDatasetSequence();
+    }
+    return sequence;
+  }
+
+  /**
    * Returns a new array containing this sequence's annotations, or null.
    */
   public AlignmentAnnotation[] getAnnotation();
@@ -519,7 +544,6 @@ public interface SequenceI extends ASequenceI
    *         list
    */
   public List<DBRefEntry> getPrimaryDBRefs();
-
   /**
    * Answers true if the sequence has annotation for Hidden Markov Model
    * information content, else false
@@ -563,7 +587,7 @@ public interface SequenceI extends ASequenceI
    * @param c1
    * @param c2
    */
-  int replace(char c1, char c2);
+  public int replace(char c1, char c2);
 
   /**
    * Answers the GeneLociI, or null if not known
@@ -593,7 +617,7 @@ public interface SequenceI extends ASequenceI
    *          the iterator to use
    * @return a String corresponding to the sequence
    */
-  String getSequenceStringFromIterator(Iterator<int[]> it);
+  public String getSequenceStringFromIterator(Iterator<int[]> it);
 
   /**
    * Locate the first position in this sequence which is not contained in an
@@ -603,7 +627,6 @@ public interface SequenceI extends ASequenceI
    *          iterator over regions
    * @return first residue not contained in regions
    */
-
   public int firstResidueOutsideIterator(Iterator<int[]> it);