2.08, not 2.07
[jalview.git] / src / jalview / datamodel / AlignmentI.java
index b46a1a7..7fe4627 100755 (executable)
+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+*\r
+* This program is free software; you can redistribute it and/or\r
+* modify it under the terms of the GNU General Public License\r
+* as published by the Free Software Foundation; either version 2\r
+* of the License, or (at your option) any later version.\r
+*\r
+* This program is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with this program; if not, write to the Free Software\r
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+*/\r
 package jalview.datamodel;\r
 \r
 import java.util.*;\r
 \r
+\r
 /** Data structure to hold and manipulate a multiple sequence alignment\r
  */\r
-public interface AlignmentI {\r
+public interface AlignmentI\r
+{\r
+    /**\r
+     *  Calculates the number of sequences in an alignment\r
+     *\r
+     * @return Number of sequences in alignment\r
+     */\r
+    public int getHeight();\r
 \r
-  public int         getHeight() ;\r
-  public int         getWidth() ;\r
-  public int         getMaxIdLength() ;\r
+    /**\r
+     * Calculates the maximum width of the alignment, including gaps.\r
+     *\r
+     * @return Greatest sequence length within alignment.\r
+     */\r
+    public int getWidth();\r
 \r
-  public boolean isAligned();\r
+    /**\r
+     * Calculates the longest sequence Id of the alignment\r
+     *\r
+     * @return Number of characters in longest sequence Id.\r
+     */\r
+    public int getMaxIdLength();\r
 \r
-  public Vector      getSequences();\r
-  public SequenceI   getSequenceAt(int i);\r
+    /**\r
+     * Calculates if this set of sequences is all the same length\r
+     *\r
+     * @return true if all sequences in alignment are the same length\r
+     */\r
+    public boolean isAligned();\r
 \r
-  public void        addSequence(SequenceI seq) ;\r
-  public void        setSequenceAt(int i,SequenceI seq);\r
+    /**\r
+     * Gets sequences as a Vector\r
+     *\r
+     * @return All sequences in alignment.\r
+     */\r
+    public Vector getSequences();\r
 \r
-  public void        deleteSequence(SequenceI s) ;\r
-  public void        deleteSequence(int i) ;\r
+    /**\r
+     * Find a specific sequence in this alignment.\r
+     *\r
+     * @param i Index of required sequence.\r
+     *\r
+     * @return SequenceI at given index.\r
+     */\r
+    public SequenceI getSequenceAt(int i);\r
 \r
-  public SequenceI[] getColumns(int start, int end) ;\r
-  public SequenceI[] getColumns(int seq1, int seq2, int start, int end) ;\r
+    /**\r
+     * Add a new sequence to this alignment.\r
+     *\r
+     * @param seq New sequence will be added at end of alignment.\r
+     */\r
+    public void addSequence(SequenceI seq);\r
 \r
-  public void        deleteColumns(int start, int end) ;\r
-  public void        deleteColumns(int seq1, int seq2, int start, int end) ;\r
+    /**\r
+     * Used to set a particular index of the alignment with the given sequence.\r
+     *\r
+     * @param i Index of sequence to be updated.\r
+     * @param seq New sequence to be inserted.\r
+     */\r
+    public void setSequenceAt(int i, SequenceI seq);\r
 \r
-  public void        insertColumns(SequenceI[] seqs, int pos) ;\r
+    /**\r
+     * Deletes a sequence from the alignment.\r
+     *\r
+     * @param s Sequence to be deleted.\r
+     */\r
+    public void deleteSequence(SequenceI s);\r
 \r
-  public SequenceI   findName(String name) ;\r
-  public SequenceI   findbyDisplayId(String name);\r
+    /**\r
+     * Deletes a sequence from the alignment.\r
+     *\r
+     * @param i Index of sequence to be deleted.\r
+     */\r
+    public void deleteSequence(int i);\r
 \r
-  public int         findIndex(SequenceI s) ;\r
+    /**\r
+     * Deletes all residues in every sequence of alignment within given columns.\r
+     *\r
+     * @param start Start index of columns to delete.\r
+     * @param end End index to columns to delete.\r
+     */\r
+    public void deleteColumns(int start, int end);\r
 \r
-  // Modifying\r
-  public void        trimLeft(int i) ;\r
-  public void        trimRight(int i) ;\r
+    /**\r
+     * Deletes all residues in every sequence of alignment within given columns.\r
+     *\r
+     * @param seq1 Index of first sequence to delete columns from.\r
+     * @param seq2 Index of last sequence to delete columns from.\r
+     * @param start Start index of columns to delete.\r
+     * @param end End index of columns to delete.\r
+     */\r
+    public void deleteColumns(int seq1, int seq2, int start, int end);\r
 \r
-  public void        removeGaps() ;\r
-  public Vector      removeRedundancy(float threshold, Vector sel) ;\r
+    /**\r
+     * Finds sequence in alignment using sequence name as query.\r
+     *\r
+     * @param name Id of sequence to search for.\r
+     *\r
+     * @return Sequence matching query, if found. If not found returns null.\r
+     */\r
+    public SequenceI findName(String name);\r
 \r
 \r
-  // Grouping methods\r
-  public SequenceGroup findGroup(int i) ;\r
-  public SequenceGroup findGroup(SequenceI s) ;\r
-  public SequenceGroup [] findAllGroups(SequenceI s);\r
-  public void          addToGroup(SequenceGroup g, SequenceI s) ;\r
-  public void          removeFromGroup(SequenceGroup g,SequenceI s) ;\r
-  public void          addGroup(SequenceGroup sg) ;\r
-  public void          deleteGroup(SequenceGroup g) ;\r
-  public Vector        getGroups();\r
-  public void deleteAllGroups();\r
+    /**\r
+     * Finds index of a given sequence in the alignment.\r
+     *\r
+     * @param s Sequence to look for.\r
+     *\r
+     * @return Index of sequence within the alignment.\r
+     */\r
+    public int findIndex(SequenceI s);\r
 \r
-  public void          addSuperGroup(SuperGroup sg);\r
-  public void          removeSuperGroup(SuperGroup sg);\r
-  public SuperGroup    getSuperGroup(SequenceGroup sg);\r
+    /**\r
+    * All sequences will be cut from beginning to given index.\r
+    *\r
+    * @param i Remove all residues in sequences up to this column.\r
+     */\r
+    public void trimLeft(int i);\r
 \r
-  // Sorting\r
-  public void          sortGroups() ;\r
-  public void          sortByPID(SequenceI s) ;\r
-  public void          sortByID() ;\r
+    /**\r
+     * All sequences will be cut from given index.\r
+     *\r
+     * @param i Remove all residues in sequences beyond this column.\r
+     */\r
+    public void trimRight(int i);\r
 \r
-  //Annotations\r
-  public void addAnnotation(AlignmentAnnotation aa);\r
-  public void deleteAnnotation(AlignmentAnnotation aa);\r
-  public AlignmentAnnotation [] getAlignmentAnnotation();\r
+    /**\r
+     * Removes all columns containing entirely gap characters.\r
+     */\r
+    public void removeGaps();\r
 \r
-  public void          setGapCharacter(char gc);\r
-  public char          getGapCharacter();\r
+    /**\r
+     * Removes redundant sequences from alignment.\r
+     *\r
+     * @param threshold Remove all sequences above the given threshold.\r
+     * @param sel Set of sequences which will have redundant sequences removed from.\r
+     *\r
+     * @return All sequences below redundancy threshold.\r
+     */\r
+    public Vector removeRedundancy(float threshold, Vector sel);\r
 \r
-  public Vector        getAAFrequency();\r
-}\r
+    /**\r
+     * Finds group that sequence at index i in alignment is part of.\r
+     *\r
+     * @param i Index in alignment.\r
+     *\r
+     * @return First group found for sequence at position i. WARNING :\r
+     * Sequences may be members of several groups. This method is incomplete.\r
+     */\r
+    public SequenceGroup findGroup(int i);\r
+\r
+    /**\r
+     * Finds group that given sequence is part of.\r
+     *\r
+     * @param s Sequence in alignment.\r
+     *\r
+     * @return First group found for sequence. WARNING :\r
+     * Sequences may be members of several groups. This method is incomplete.\r
+     */\r
+    public SequenceGroup findGroup(SequenceI s);\r
+\r
+    /**\r
+     * Finds all groups that a given sequence is part of.\r
+     *\r
+     * @param s Sequence in alignment.\r
+     *\r
+     * @return All groups containing given sequence.\r
+     */\r
+    public SequenceGroup[] findAllGroups(SequenceI s);\r
+\r
+    /**\r
+     * Adds a new SequenceGroup to this alignment.\r
+     *\r
+     * @param sg New group to be added.\r
+     */\r
+    public void addGroup(SequenceGroup sg);\r
+\r
+    /**\r
+     * Deletes a specific SequenceGroup\r
+     *\r
+     * @param g Group will be deleted from alignment.\r
+     */\r
+    public void deleteGroup(SequenceGroup g);\r
+\r
+    /**\r
+     * Get all the groups associated with this alignment.\r
+     *\r
+     * @return All groups as a Vector.\r
+     */\r
+    public Vector getGroups();\r
+\r
+    /**\r
+     * Deletes all groups from this alignment.\r
+     */\r
+    public void deleteAllGroups();\r
+\r
+\r
+    /**\r
+     * Adds a new AlignmentAnnotation to this alignment\r
+     */\r
+    public void addAnnotation(AlignmentAnnotation aa);\r
+\r
+    /**\r
+     * Adds a new AlignmentAnnotation to this alignment,\r
+     *  associated to Sequence starting at sequence index\r
+     */\r
+    public AlignmentAnnotation addAnnotation(AlignmentAnnotation aa, SequenceI seqRef);\r
+\r
+    public void setAnnotationIndex(AlignmentAnnotation aa, int index);\r
 \r
+    /**\r
+     * Deletes a specific AlignmentAnnotation from the alignment.\r
+     *\r
+     * @param aa DOCUMENT ME!\r
+     */\r
+    public void deleteAnnotation(AlignmentAnnotation aa);\r
 \r
+    /**\r
+     * DOCUMENT ME!\r
+     *\r
+     * @return DOCUMENT ME!\r
+     */\r
+    public AlignmentAnnotation[] getAlignmentAnnotation();\r
 \r
+    /**\r
+     * DOCUMENT ME!\r
+     *\r
+     * @param gc DOCUMENT ME!\r
+     */\r
+    public void setGapCharacter(char gc);\r
+\r
+    /**\r
+     * DOCUMENT ME!\r
+     *\r
+     * @return DOCUMENT ME!\r
+     */\r
+    public char getGapCharacter();\r
+\r
+    /**\r
+     * DOCUMENT ME!\r
+     *\r
+     * @return DOCUMENT ME!\r
+     */\r
+    public Vector getAAFrequency();\r
+\r
+    /**\r
+     * Returns true if alignment is nucleotide sequence\r
+     *\r
+     * @return DOCUMENT ME!\r
+     */\r
+    public boolean isNucleotide();\r
+\r
+    /**\r
+     * Set true if the alignment is a nucleotide sequence\r
+     *\r
+     * @return\r
+     */\r
+    public void setNucleotide(boolean b);\r
+\r
+\r
+    public Alignment getDataset();\r
+\r
+    public void setDataset(Alignment dataset);\r
+    /**\r
+     * pads sequences with gaps (to ensure the set looks like an alignment)\r
+     * @return boolean true if alignment was modified\r
+     */\r
+    public boolean padGaps();\r
+\r
+    public void adjustSequenceAnnotations();\r
+\r
+    public HiddenSequences getHiddenSequences();\r
+\r
+}\r