Merge branch 'develop' into features/JAL-1793VCF
[jalview.git] / src / jalview / datamodel / SequenceI.java
index 1615bee..c064373 100755 (executable)
@@ -21,6 +21,7 @@
 package jalview.datamodel;
 
 import jalview.datamodel.features.SequenceFeaturesI;
+import jalview.util.MapList;
 
 import java.util.BitSet;
 import java.util.List;
@@ -119,9 +120,9 @@ public interface SequenceI extends ASequenceI
   public String getSequenceAsString(int start, int end);
 
   /**
-   * Get the sequence as a character array
+   * Answers a copy of the sequence as a character array
    * 
-   * @return seqeunce and any gaps
+   * @return
    */
   public char[] getSequence();
 
@@ -203,6 +204,16 @@ public interface SequenceI extends ASequenceI
   public int findPosition(int i);
 
   /**
+   * Returns the from-to sequence positions (start..) for the given column
+   * positions (1..), or null if no residues are included in the range
+   * 
+   * @param fromColum
+   * @param toColumn
+   * @return
+   */
+  public Range findPositions(int fromColum, int toColumn);
+
+  /**
    * Returns an int array where indices correspond to each residue in the
    * sequence and the element value gives its position in the alignment
    * 
@@ -266,7 +277,7 @@ public interface SequenceI extends ASequenceI
    * Answers a list of all sequence features associated with this sequence. The
    * list may be held by the sequence's dataset sequence if that is defined.
    * 
-   * @return hard reference to array
+   * @return
    */
   public List<SequenceFeature> getSequenceFeatures();
 
@@ -439,17 +450,6 @@ public interface SequenceI extends ASequenceI
   public void transferAnnotation(SequenceI entry, Mapping mp);
 
   /**
-   * @param index
-   *          The sequence index in the MSA
-   */
-  public void setIndex(int index);
-
-  /**
-   * @return The index of the sequence in the alignment
-   */
-  public int getIndex();
-
-  /**
    * @return The RNA of the sequence in the alignment
    */
 
@@ -501,6 +501,13 @@ public interface SequenceI extends ASequenceI
    * @return
    */
   List<SequenceFeature> findFeatures(int fromCol, int toCol, String... types);
+
+  /**
+   * Method to call to indicate that the sequence (characters or alignment/gaps)
+   * has been modified. Provided to allow any cursors on residue/column
+   * positions to be invalidated.
+   */
+  void sequenceChanged();
   
   /**
    * 
@@ -508,4 +515,31 @@ public interface SequenceI extends ASequenceI
    *         returns true.
    */
   BitSet getInsertionsAsBits();
+
+  /**
+   * Replaces every occurrence of c1 in the sequence with c2 and returns the
+   * number of characters changed
+   * 
+   * @param c1
+   * @param c2
+   */
+  public int replace(char c1, char c2);
+
+  /**
+   * Answers the GeneLociI, or null if not known
+   * 
+   * @return
+   */
+  GeneLociI getGeneLoci();
+
+  /**
+   * Sets the mapping to gene loci for the sequence
+   * 
+   * @param speciesId
+   * @param assemblyId
+   * @param chromosomeId
+   * @param map
+   */
+  void setGeneLoci(String speciesId, String assemblyId,
+          String chromosomeId, MapList map);
 }