* 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
-\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
+ * Adds a super group. A SuperGroup is a group of groups.\r
+ *\r
+ * @param sg Adds a new SuperGroup to alignment\r
+ */\r
+ public void addSuperGroup(SuperGroup sg);\r
+\r
+ /**\r
+ * Removes SuperGroup from alignment.\r
+ *\r
+ * @param sg This SuperGroup will be deleted from alignment.\r
+ */\r
+ public void removeSuperGroup(SuperGroup sg);\r
+\r
+ /**\r
+ * Finds any SuperGroup that a given SequenceGroup may be part of.\r
+ *\r
+ * @param sg SequenceGroup to search for.\r
+ *\r
+ * @return SuperGroup that contains the given SequenceGroup.\r
+ */\r
+ public SuperGroup getSuperGroup(SequenceGroup sg);\r
\r
+ /**\r
+ * Adds a new AlignmentAnnotation to this alignment\r
+ */\r
+ public void addAnnotation(AlignmentAnnotation aa);\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
+\r
+}\r