Package jgromacs.data

# Class Alignment

java.lang.Object
jgromacs.data.Alignment

All Implemented Interfaces:
  `Cloneable`

public class Alignment extends Object implements Cloneable
Objects of this class represent a sequence alignment

## Constructor Summary

Constructors
Constructor
Description
`Alignment()`
Constructs a new Alignment object

## Method Summary

Modifier and Type
Method
Description
`void`
`addSequence(Sequence seq)`
Adds a new sequence to the alignment
`Object`
`clone()`
Returns an identical Alignment object
`boolean`
`equals(Object other)`
Returns true if the two alignments are identical
`Alignment`
`getCollapsedAlignment()`
Returns the collapsed alignment in which only the match columns are included (i.e.
`Sequence`
`getConsensusSequence()`
Returns the (majority) consensus sequence of the alignment
`IndexSetList`
`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 alignment
`ArrayList<Integer>`
`getMatchPositionIndicesAsArrayList(int i)`
Returns the list of match position indices in sequence #i as an ArrayList object
`int`
`getMaxSequenceLength()`
Returns the length of the longest sequence in the alignment
`int`
`getMinSequenceLength()`
Returns the length of the shortest sequence in the alignment
`ResidueType`
`getMostFrequentResidueType(int i)`
Returns the most frequent residue type in column #i of the alignment
`int`
`getNumberOfSequences()`
Returns the number of sequences in the alignment
`Sequence`
`getSequence(int i)`
Returns sequence #i of the alignment
`ArrayList<Sequence>`
`getSequencesAsArrayList()`
Returns sequences of the alignment as an ArrayList object
`int`
`hashCode()`
Returns hash code
`boolean`
`isMatchColumn(int i)`
Returns true if column #i is a match column (i.e.
`void`
`removeColumn(int i)`
Removes column #i from the alignment
`void`
`removeSequence(int i)`
Removes sequence #i from the alignment
`void`
`removeSequence(Sequence seq)`
Removes the given sequence from the alignment
`void`
`setSequence(int i, Sequence seq)`
Replaces sequence #i of the alignment with a new sequence
`String`
`toString()`
Returns the String representation of alignment
`String`
`toStringInfo()`
Returns summary information about the alignment

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### Alignment

public Alignment()
Constructs a new Alignment object

## Method Details

### getSequence

public Sequence getSequence(int i)
Returns sequence #i of the alignment

Returns:
  sequence #i

### getSequencesAsArrayList

public 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 ArrayList<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 String toString()
Returns the String representation of alignment

Overrides:
  `toString` in class `Object`
Returns:
  String representation

### toStringInfo

public String toStringInfo()
Returns summary information about the alignment

Returns:
  summary information

### clone

public Object clone()
Returns an identical Alignment object

Overrides:
  `clone` in class `Object`
Returns:
  clone of the alignment

### equals

public boolean equals(Object other)
Returns true if the two alignments are identical

Overrides:
  `equals` in class `Object`
Parameters:
  `other` - the other alignment

### hashCode

public int hashCode()
Returns hash code

Overrides:
  `hashCode` in class `Object`