Merge branch 'develop' into bug/JAL-2541cutRelocateFeatures
authorJim Procter <jprocter@issues.jalview.org>
Thu, 16 Nov 2017 16:53:26 +0000 (16:53 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 16 Nov 2017 16:53:26 +0000 (16:53 +0000)
1  2 
src/jalview/datamodel/Sequence.java
src/jalview/datamodel/SequenceI.java

@@@ -42,7 -42,10 +42,7 @@@ import fr.orsay.lri.varna.models.rna.RN
  
  /**
   * 
 - * Implements the SequenceI interface for a char[] based sequence object.
 - * 
 - * @author $author$
 - * @version $Revision$
 + * Implements the SequenceI interface for a char[] based sequence object
   */
  public class Sequence extends ASequence implements SequenceI
  {
     */
    Vector<AlignmentAnnotation> annotation;
  
-   /**
-    * The index of the sequence in a MSA
-    */
-   int index = -1;
    private SequenceFeaturesI sequenceFeatureStore;
  
    /*
       * preserve end residue column provided cursor was valid
       */
      int endColumn = isValidCursor(cursor) ? cursor.lastColumnPosition : 0;
 +
      if (residuePos == this.end)
      {
        endColumn = column;
      /*
       * move left or right to find pos from hint.position
       */
 -    int col = curs.columnPosition - 1; // convert from base 1 to 0-based array
 -                                       // index
 +    int col = curs.columnPosition - 1; // convert from base 1 to base 0
      int newPos = curs.residuePosition;
      int delta = newPos > pos ? -1 : 1;
  
      boolean createNewDs = false;
      // TODO: take a (second look) at the dataset creation validation method for
      // the very large sequence case
 +
      int startIndex = findIndex(start) - 1;
      int endIndex = findIndex(end) - 1;
      int startDeleteColumn = -1; // for dataset sequence deletions
      int deleteCount = 0;
  
 -    for (int s = i; s < j; s++)
 +    for (int s = i; s < j && s < sequence.length; s++)
      {
        if (Comparison.isGap(sequence[s]))
        {
      }
    }
  
-   /**
-    * @return The index (zero-based) of this sequence in the MSA. It returns
-    *         {@code -1} if this information is not available.
-    */
-   @Override
-   public int getIndex()
-   {
-     return index;
-   }
-   /**
-    * Defines the (zero-based) position of this sequence in the MSA. Use the
-    * value {@code -1} if this information is undefined.
-    * 
-    * @param value
-    */
-   @Override
-   public void setIndex(int value)
-   {
-     index = value;
-   }
    @Override
    public void setRNA(RNA r)
    {
  
      List<SequenceFeature> result = getFeatures().findFeatures(startPos,
              endPos, types);
 +    if (datasetSequence != null)
 +    {
 +      result = datasetSequence.getFeatures().findFeatures(startPos, endPos,
 +              types);
 +    }
 +    else
 +    {
 +      result = sequenceFeatureStore.findFeatures(startPos, endPos, types);
 +    }
  
      /*
       * if end column is gapped, endPos may be to the right, 
@@@ -204,14 -204,11 +204,14 @@@ public interface SequenceI extends ASeq
    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
 +   * Returns the sequence positions for first and last residues lying within the
 +   * given column positions [fromColum,toColumn] (where columns are numbered
 +   * from 1), or null if no residues are included in the range
     * 
     * @param fromColum
 +   *          - first column base 1
     * @param toColumn
 +   *          - last column, base 1
     * @return
     */
    public Range findPositions(int fromColum, int toColumn);
    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
     */
  
     * @param c1
     * @param c2
     */
 -  public int replace(char c1, char c2);
 +  int replace(char c1, char c2);
  }