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.CloneableObjects 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 voidaddSequence(Sequence seq)Adds a new sequence to the alignmentjava.lang.Objectclone()Returns an identical Alignment objectbooleanequals(java.lang.Object other)Returns true if the two alignments are identicalAlignmentgetCollapsedAlignment()Returns the collapsed alignment in which only the match columns are included (i.e.SequencegetConsensusSequence()Returns the (majority) consensus sequence of the alignmentIndexSetListgetMatchPositionIndexSets()Returns the list of match position index sets (i.e.IndexSetgetMatchPositionIndices(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 objectintgetMaxSequenceLength()Returns the length of the longest sequence in the alignmentintgetMinSequenceLength()Returns the length of the shortest sequence in the alignmentResidueTypegetMostFrequentResidueType(int i)Returns the most frequent residue type in column #i of the alignmentintgetNumberOfSequences()Returns the number of sequences in the alignmentSequencegetSequence(int i)Returns sequence #i of the alignmentjava.util.ArrayList<Sequence>getSequencesAsArrayList()Returns sequences of the alignment as an ArrayList objectinthashCode()Returns hash codebooleanisMatchColumn(int i)Returns true if column #i is a match column (i.e.voidremoveColumn(int i)Removes column #i from the alignmentvoidremoveSequence(int i)Removes sequence #i from the alignmentvoidremoveSequence(Sequence seq)Removes the given sequence from the alignmentvoidsetSequence(int i, Sequence seq)Replaces sequence #i of the alignment with a new sequencejava.lang.StringtoString()Returns the String representation of alignmentjava.lang.StringtoStringInfo()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:
toStringin 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:
clonein 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:
equalsin classjava.lang.Object- Parameters:
other- the other alignment
-
hashCode
public int hashCode()
Returns hash code- Overrides:
hashCodein classjava.lang.Object
-
-