Package jgromacs.data

Class 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 Detail

      • Alignment

        public Alignment()
        Constructs a new Alignment object
    • 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 class java.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 class java.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 class java.lang.Object
        Parameters:
        other - the other alignment
      • hashCode

        public int hashCode()
        Returns hash code
        Overrides:
        hashCode in class java.lang.Object