Package jgromacs.data
Class Alignment
- java.lang.Object
-
- jgromacs.data.Alignment
-
- All Implemented Interfaces:
java.lang.Cloneable
public class Alignment extends java.lang.Object implements java.lang.Cloneable
Objects of this class represent a sequence alignment
-
-
Constructor Summary
Constructors Constructor Description Alignment()
Constructs a new Alignment object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSequence(Sequence seq)
Adds a new sequence to the alignmentjava.lang.Object
clone()
Returns an identical Alignment objectboolean
equals(java.lang.Object other)
Returns true if the two alignments are identicalAlignment
getCollapsedAlignment()
Returns the collapsed alignment in which only the match columns are included (i.e.Sequence
getConsensusSequence()
Returns the (majority) consensus sequence of the alignmentIndexSetList
getMatchPositionIndexSets()
Returns the list of match position index sets (i.e.IndexSet
getMatchPositionIndices(int i)
Returns the set of position indices in sequence #i that are included in the match columns of alignmentjava.util.ArrayList<java.lang.Integer>
getMatchPositionIndicesAsArrayList(int i)
Returns the list of match position indices in sequence #i as an ArrayList objectint
getMaxSequenceLength()
Returns the length of the longest sequence in the alignmentint
getMinSequenceLength()
Returns the length of the shortest sequence in the alignmentResidueType
getMostFrequentResidueType(int i)
Returns the most frequent residue type in column #i of the alignmentint
getNumberOfSequences()
Returns the number of sequences in the alignmentSequence
getSequence(int i)
Returns sequence #i of the alignmentjava.util.ArrayList<Sequence>
getSequencesAsArrayList()
Returns sequences of the alignment as an ArrayList objectint
hashCode()
Returns hash codeboolean
isMatchColumn(int i)
Returns true if column #i is a match column (i.e.void
removeColumn(int i)
Removes column #i from the alignmentvoid
removeSequence(int i)
Removes sequence #i from the alignmentvoid
removeSequence(Sequence seq)
Removes the given sequence from the alignmentvoid
setSequence(int i, Sequence seq)
Replaces sequence #i of the alignment with a new sequencejava.lang.String
toString()
Returns the String representation of alignmentjava.lang.String
toStringInfo()
Returns summary information about the alignment
-
-
-
Method Detail
-
getSequence
public Sequence getSequence(int i)
Returns sequence #i of the alignment- Returns:
- sequence #i
-
getSequencesAsArrayList
public java.util.ArrayList<Sequence> getSequencesAsArrayList()
Returns sequences of the alignment as an ArrayList object- Returns:
- list of sequences as an ArrayList
-
getNumberOfSequences
public int getNumberOfSequences()
Returns the number of sequences in the alignment- Returns:
- number of sequences
-
getMaxSequenceLength
public int getMaxSequenceLength()
Returns the length of the longest sequence in the alignment- Returns:
- length of longest sequence
-
getMinSequenceLength
public int getMinSequenceLength()
Returns the length of the shortest sequence in the alignment- Returns:
- length of shortest sequence
-
addSequence
public void addSequence(Sequence seq)
Adds a new sequence to the alignment- Parameters:
seq
- new sequence
-
setSequence
public void setSequence(int i, Sequence seq)
Replaces sequence #i of the alignment with a new sequence- Parameters:
seq
- new sequence
-
removeSequence
public void removeSequence(int i)
Removes sequence #i from the alignment
-
removeSequence
public void removeSequence(Sequence seq)
Removes the given sequence from the alignment- Parameters:
seq
- the sequence to be removed
-
removeColumn
public void removeColumn(int i)
Removes column #i from the alignment
-
isMatchColumn
public boolean isMatchColumn(int i)
Returns true if column #i is a match column (i.e. there is no gap in column #i of the alignment)
-
getCollapsedAlignment
public Alignment getCollapsedAlignment()
Returns the collapsed alignment in which only the match columns are included (i.e. the columns without gaps)- Returns:
- collapsed alignment
-
getMatchPositionIndices
public IndexSet getMatchPositionIndices(int i)
Returns the set of position indices in sequence #i that are included in the match columns of alignment- Returns:
- index set of match positions
-
getMatchPositionIndexSets
public IndexSetList getMatchPositionIndexSets()
Returns the list of match position index sets (i.e. match position index group of each sequence in the alignment)- Returns:
- list of match positions index set
-
getMatchPositionIndicesAsArrayList
public java.util.ArrayList<java.lang.Integer> getMatchPositionIndicesAsArrayList(int i)
Returns the list of match position indices in sequence #i as an ArrayList object- Returns:
- ArrayList of match positions
-
getMostFrequentResidueType
public ResidueType getMostFrequentResidueType(int i)
Returns the most frequent residue type in column #i of the alignment- Returns:
- most frequent residue type
-
getConsensusSequence
public Sequence getConsensusSequence()
Returns the (majority) consensus sequence of the alignment- Returns:
- consensus sequence
-
toString
public java.lang.String toString()
Returns the String representation of alignment- Overrides:
toString
in classjava.lang.Object
- Returns:
- String representation
-
toStringInfo
public java.lang.String toStringInfo()
Returns summary information about the alignment- Returns:
- summary information
-
clone
public java.lang.Object clone()
Returns an identical Alignment object- Overrides:
clone
in classjava.lang.Object
- Returns:
- clone of the alignment
-
equals
public boolean equals(java.lang.Object other)
Returns true if the two alignments are identical- Overrides:
equals
in classjava.lang.Object
- Parameters:
other
- the other alignment
-
hashCode
public int hashCode()
Returns hash code- Overrides:
hashCode
in classjava.lang.Object
-
-