Package pal.alignment
Class AbstractAlignment
- java.lang.Object
-
- pal.alignment.AbstractAlignment
-
- Direct Known Subclasses:
BootstrappedAlignment,ConcatenatedAlignment,ConcatenatedAnnotatedAlignment,GapBalancedAlignment,IndelAlignment,JumbledAlignment,ReadAlignment,ReadAlignmentOld,SimpleAlignment,SimulatedAlignment,SitePattern,StrippedAlignment
public abstract class AbstractAlignment extends java.lang.Object implements Alignment, java.io.Serializable, IdGroup, Report
abstract base class for any alignment data.- Version:
- $Id: AbstractAlignment.java,v 1.7 2003/03/23 00:12:57 matt Exp $
- Author:
- Alexei Drummond, Korbinian Strimmer
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface pal.misc.IdGroup
IdGroup.Utils
-
-
Constructor Summary
Constructors Constructor Description AbstractAlignment()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAlignedSequenceString(int seq)Returns a string representing a single sequence (including gaps) from this alignment.protected chargetChar(int state)Same as getDataType().getChar(state)abstract chargetData(int seq, int site)sequence alignment at (sequence, site)DataTypegetDataType()Returns the datatype of this alignmentintgetIdCount()Returns the number of identifiers in this groupIdentifiergetIdentifier(int i)Returns the ith identifier.intgetLength()Return number of sites in this alignmentintgetSequenceCount()Return number of sequences in this alignmentintgetSiteCount()Return number of sites for each sequence in this alignmentprotected intgetState(char c)Same as getDataType().getState(char)int[][]getStates()Fills a [numsequences][length] matrix with indices.voidguessDataType()Guess data typebooleanisGap(int seq, int site)returns true if there is a gap in the give position.protected booleanisUnknownState(int state)Same as getDataType().isUnknownState(state)voidreport(java.io.PrintWriter out)print human readable report (e.g., on parameters and associated model)voidsetDataType(DataType d)Sets the datatype of this alignmentvoidsetIdentifier(int i, Identifier ident)Sets the ith identifier.java.lang.StringtoString()returns representation of this alignment as a stringintwhichIdNumber(java.lang.String name)returns the index of the identifier with the given name.
-
-
-
Field Detail
-
numSeqs
protected int numSeqs
number of sequences
-
numSites
protected int numSites
length of each sequence
-
idGroup
protected IdGroup idGroup
sequence identifiers
-
-
Method Detail
-
getData
public abstract char getData(int seq, int site)sequence alignment at (sequence, site)
-
isGap
public boolean isGap(int seq, int site)returns true if there is a gap in the give position.
-
guessDataType
public void guessDataType()
Guess data type
-
getChar
protected final char getChar(int state)
Same as getDataType().getChar(state)
-
getState
protected final int getState(char c)
Same as getDataType().getState(char)
-
isUnknownState
protected final boolean isUnknownState(int state)
Same as getDataType().isUnknownState(state)
-
getDataType
public final DataType getDataType()
Returns the datatype of this alignment- Specified by:
getDataTypein interfaceAlignment
-
setDataType
public final void setDataType(DataType d)
Sets the datatype of this alignment
-
toString
public java.lang.String toString()
returns representation of this alignment as a string- Overrides:
toStringin classjava.lang.Object
-
report
public void report(java.io.PrintWriter out)
Description copied from interface:Reportprint human readable report (e.g., on parameters and associated model)
-
getStates
public int[][] getStates()
Fills a [numsequences][length] matrix with indices. Each index represents the sequence state, -1 means a gap.
-
getLength
public final int getLength()
Return number of sites in this alignment
-
getSequenceCount
public final int getSequenceCount()
Return number of sequences in this alignment- Specified by:
getSequenceCountin interfaceAlignment
-
getSiteCount
public final int getSiteCount()
Return number of sites for each sequence in this alignment- Specified by:
getSiteCountin interfaceAlignment- Returns:
- number of sites for each sequence in this alignment
-
getAlignedSequenceString
public java.lang.String getAlignedSequenceString(int seq)
Returns a string representing a single sequence (including gaps) from this alignment.- Specified by:
getAlignedSequenceStringin interfaceAlignment
-
getIdentifier
public Identifier getIdentifier(int i)
Description copied from interface:IdGroupReturns the ith identifier.- Specified by:
getIdentifierin interfaceIdGroup
-
setIdentifier
public void setIdentifier(int i, Identifier ident)Description copied from interface:IdGroupSets the ith identifier.- Specified by:
setIdentifierin interfaceIdGroup
-
getIdCount
public int getIdCount()
Description copied from interface:IdGroupReturns the number of identifiers in this group- Specified by:
getIdCountin interfaceIdGroup
-
whichIdNumber
public int whichIdNumber(java.lang.String name)
Description copied from interface:IdGroupreturns the index of the identifier with the given name.- Specified by:
whichIdNumberin interfaceIdGroup
-
-