merge from 2_4_Release branch
[jalview.git] / src / jalview / datamodel / AlignmentI.java
index f89602f..b4075a0 100755 (executable)
@@ -1,17 +1,17 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
@@ -20,88 +20,96 @@ package jalview.datamodel;
 
 import java.util.*;
 
-/** Data structure to hold and manipulate a multiple sequence alignment
+/**
+ * Data structure to hold and manipulate a multiple sequence alignment
  */
 public interface AlignmentI
 {
   /**
-   *  Calculates the number of sequences in an alignment
-   *
+   * Calculates the number of sequences in an alignment
+   * 
    * @return Number of sequences in alignment
    */
   public int getHeight();
 
   /**
    * Calculates the maximum width of the alignment, including gaps.
-   *
+   * 
    * @return Greatest sequence length within alignment.
    */
   public int getWidth();
 
   /**
    * Calculates if this set of sequences is all the same length
-   *
+   * 
    * @return true if all sequences in alignment are the same length
    */
   public boolean isAligned();
 
   /**
    * Gets sequences as a Vector
-   *
+   * 
    * @return All sequences in alignment.
    */
   public Vector getSequences();
 
   /**
    * Gets sequences as a SequenceI[]
-   *
+   * 
    * @return All sequences in alignment.
    */
   public SequenceI[] getSequencesArray();
 
   /**
    * Find a specific sequence in this alignment.
-   *
-   * @param i Index of required sequence.
-   *
+   * 
+   * @param i
+   *                Index of required sequence.
+   * 
    * @return SequenceI at given index.
    */
   public SequenceI getSequenceAt(int i);
 
   /**
    * Add a new sequence to this alignment.
-   *
-   * @param seq New sequence will be added at end of alignment.
+   * 
+   * @param seq
+   *                New sequence will be added at end of alignment.
    */
   public void addSequence(SequenceI seq);
 
   /**
    * Used to set a particular index of the alignment with the given sequence.
-   *
-   * @param i Index of sequence to be updated.
-   * @param seq New sequence to be inserted.
+   * 
+   * @param i
+   *                Index of sequence to be updated.
+   * @param seq
+   *                New sequence to be inserted.
    */
   public void setSequenceAt(int i, SequenceI seq);
 
   /**
    * Deletes a sequence from the alignment
-   *
-   * @param s Sequence to be deleted.
+   * 
+   * @param s
+   *                Sequence to be deleted.
    */
   public void deleteSequence(SequenceI s);
 
   /**
    * Deletes a sequence from the alignment.
-   *
-   * @param i Index of sequence to be deleted.
+   * 
+   * @param i
+   *                Index of sequence to be deleted.
    */
   public void deleteSequence(int i);
 
   /**
    * Finds sequence in alignment using sequence name as query.
-   *
-   * @param name Id of sequence to search for.
-   *
+   * 
+   * @param name
+   *                Id of sequence to search for.
+   * 
    * @return Sequence matching query, if found. If not found returns null.
    */
   public SequenceI findName(String name);
@@ -110,54 +118,58 @@ public interface AlignmentI
 
   /**
    * Finds index of a given sequence in the alignment.
-   *
-   * @param s Sequence to look for.
-   *
+   * 
+   * @param s
+   *                Sequence to look for.
+   * 
    * @return Index of sequence within the alignment.
    */
   public int findIndex(SequenceI s);
 
   /**
    * Finds group that given sequence is part of.
-   *
-   * @param s Sequence in alignment.
-   *
-   * @return First group found for sequence. WARNING :
-   * Sequences may be members of several groups. This method is incomplete.
+   * 
+   * @param s
+   *                Sequence in alignment.
+   * 
+   * @return First group found for sequence. WARNING : Sequences may be members
+   *         of several groups. This method is incomplete.
    */
   public SequenceGroup findGroup(SequenceI s);
 
   /**
    * Finds all groups that a given sequence is part of.
-   *
-   * @param s Sequence in alignment.
-   *
+   * 
+   * @param s
+   *                Sequence in alignment.
+   * 
    * @return All groups containing given sequence.
    */
   public SequenceGroup[] findAllGroups(SequenceI s);
 
   /**
    * Adds a new SequenceGroup to this alignment.
-   *
-   * @param sg New group to be added.
+   * 
+   * @param sg
+   *                New group to be added.
    */
   public void addGroup(SequenceGroup sg);
 
   /**
    * Deletes a specific SequenceGroup
-   *
-   * @param g Group will be deleted from alignment.
+   * 
+   * @param g
+   *                Group will be deleted from alignment.
    */
   public void deleteGroup(SequenceGroup g);
 
   /**
    * Get all the groups associated with this alignment.
-   *
+   * 
    * @return All groups as a Vector.
    */
   public Vector getGroups();
 
-
   /**
    * Deletes all groups from this alignment.
    */
@@ -165,77 +177,88 @@ public interface AlignmentI
 
   /**
    * Adds a new AlignmentAnnotation to this alignment
-   * @note Care should be taken to ensure that annotation is at
-   * least as wide as the longest sequence in the alignment
-   * for rendering purposes.
+   * 
+   * @note Care should be taken to ensure that annotation is at least as wide as
+   *       the longest sequence in the alignment for rendering purposes.
    */
   public void addAnnotation(AlignmentAnnotation aa);
+
   /**
    * moves annotation to a specified index in alignment annotation display stack
-   * @param aa the annotation object to be moved
-   * @param index the destination position
+   * 
+   * @param aa
+   *                the annotation object to be moved
+   * @param index
+   *                the destination position
    */
   public void setAnnotationIndex(AlignmentAnnotation aa, int index);
 
   /**
-   * Deletes a specific AlignmentAnnotation from the alignment,
-   * and removes its reference from any SequenceI object's annotation
-   * if and only if aa is contained within the alignment's annotation
-   * vector. Otherwise, it will do nothing.
+   * Deletes a specific AlignmentAnnotation from the alignment, and removes its
+   * reference from any SequenceI object's annotation if and only if aa is
+   * contained within the alignment's annotation vector. Otherwise, it will do
+   * nothing.
    * 
-   * @param aa the annotation to delete
+   * @param aa
+   *                the annotation to delete
    * @return true if annotation was deleted from this alignment.
    */
   public boolean deleteAnnotation(AlignmentAnnotation aa);
 
   /**
    * Get the annotation associated with this alignment
-   *
+   * 
    * @return array of AlignmentAnnotation objects
    */
   public AlignmentAnnotation[] getAlignmentAnnotation();
 
   /**
    * Change the gap character used in this alignment to 'gc'
-   *
-   * @param gc the new gap character.
+   * 
+   * @param gc
+   *                the new gap character.
    */
   public void setGapCharacter(char gc);
 
   /**
    * Get the gap character used in this alignment
-   *
+   * 
    * @return gap character
    */
   public char getGapCharacter();
 
   /**
    * Test for all nucleotide alignment
-   *
+   * 
    * @return true if alignment is nucleotide sequence
    */
   public boolean isNucleotide();
 
   /**
    * Set alignment to be a nucleotide sequence
-   *
+   * 
    */
   public void setNucleotide(boolean b);
 
   /**
    * Get the associated dataset for the alignment.
-   * @return Alignment containing dataset sequences or null of this is a dataset.
+   * 
+   * @return Alignment containing dataset sequences or null of this is a
+   *         dataset.
    */
   public Alignment getDataset();
 
   /**
    * Set the associated dataset for the alignment, or create one.
-   * @param dataset The dataset alignment or null to construct one.
+   * 
+   * @param dataset
+   *                The dataset alignment or null to construct one.
    */
   public void setDataset(Alignment dataset);
 
   /**
    * pads sequences with gaps (to ensure the set looks like an alignment)
+   * 
    * @return boolean true if alignment was modified
    */
   public boolean padGaps();
@@ -244,70 +267,96 @@ public interface AlignmentI
 
   /**
    * Compact representation of alignment
+   * 
    * @return CigarArray
    */
   public CigarArray getCompactAlignment();
 
   /**
-   * Set an arbitrary key value pair for an alignment.
-   * Note: both key and value objects should return a 
-   * meaningful, human readable response to .toString()
+   * Set an arbitrary key value pair for an alignment. Note: both key and value
+   * objects should return a meaningful, human readable response to .toString()
+   * 
    * @param key
    * @param value
    */
   public void setProperty(Object key, Object value);
+
   /**
-   * Get a named property from the alignment. 
+   * Get a named property from the alignment.
+   * 
    * @param key
    * @return value of property
    */
   public Object getProperty(Object key);
+
   /**
    * Get the property hashtable.
+   * 
    * @return hashtable of alignment properties (or null if none are defined)
    */
   public Hashtable getProperties();
 
   /**
    * add a reference to a frame of aligned codons for this alignment
+   * 
    * @param codons
    */
   public void addCodonFrame(AlignedCodonFrame codons);
+
   /**
    * remove a particular codon frame reference from this alignment
+   * 
    * @param codons
    * @return true if codon frame was removed.
    */
   public boolean removeCodonFrame(AlignedCodonFrame codons);
+
   /**
    * get all codon frames associated with this alignment
+   * 
    * @return
    */
   public AlignedCodonFrame[] getCodonFrames();
+
   /**
    * get a particular codon frame
+   * 
    * @param index
    * @return
    */
   public AlignedCodonFrame getCodonFrame(int index);
+
   /**
    * get codon frames involving sequenceI
    */
   public AlignedCodonFrame[] getCodonFrame(SequenceI seq);
+
   /**
    * find sequence with given name in alignment
-   * @param token name to find
-   * @param b true implies that case insensitive matching will <em>also</em> be tried 
+   * 
+   * @param token
+   *                name to find
+   * @param b
+   *                true implies that case insensitive matching will
+   *                <em>also</em> be tried
    * @return matched sequence or null
    */
   public SequenceI findName(String token, boolean b);
+
   /**
-   * find next sequence with given name in alignment starting after a given sequence
-   * @param startAfter the sequence after which the search will be started (usually the result of the last call to findName) 
-   * @param token name to find
-   * @param b true implies that case insensitive matching will <em>also</em> be tried 
+   * find next sequence with given name in alignment starting after a given
+   * sequence
+   * 
+   * @param startAfter
+   *                the sequence after which the search will be started (usually
+   *                the result of the last call to findName)
+   * @param token
+   *                name to find
+   * @param b
+   *                true implies that case insensitive matching will
+   *                <em>also</em> be tried
    * @return matched sequence or null
    */
   public SequenceI findName(SequenceI startAfter, String token, boolean b);
-  
+
 }