Package pal.alignment
Class SimpleCharacterAlignment
- java.lang.Object
-
- pal.alignment.SimpleCharacterAlignment
-
- All Implemented Interfaces:
java.io.Serializable
,CharacterAlignment
,IdGroup
,Report
,TableReport
public class SimpleCharacterAlignment extends java.lang.Object implements CharacterAlignment, java.io.Serializable, IdGroup, Report
This provides a basic implementation of CharacterAlignment. This class holds quantitative character states. Each trait (a quantitative character) has two sets of labels. One is the traitName, and the second is the environmentName. Obviously any descriptor could be placed in these two labels, however for printing purposes traitName is printed first. Double.NaN is assumed to be the missing value.- Version:
- $Id: SimpleCharacterAlignment.java,v 1
- Author:
- Ed Buckler
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface pal.misc.IdGroup
IdGroup.Utils
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String[]
environmentNames
names of the traitsprotected IdGroup
idGroup
sequence identifiersprotected int
numSeqs
number of sequencesprotected int
numTraits
number of traitsprotected java.lang.String[]
traitNames
names of the traitsprotected double[][]
traitValues
trait values-
Fields inherited from interface pal.alignment.CharacterAlignment
MISSING
-
-
Constructor Summary
Constructors Constructor Description SimpleCharacterAlignment()
SimpleCharacterAlignment(Identifier[] ids, double[][] traitValues, java.lang.String[] traitNames)
Constructor for SimpleCharacterAlignment.SimpleCharacterAlignment(IdGroup group, double[][] traitValues, java.lang.String[] traitNames)
Constructor for SimpleCharacterAlignment.SimpleCharacterAlignment(IdGroup group, double[][] traitValues, java.lang.String[] traitNames, java.lang.String[] environNames)
Constructor for SimpleCharacterAlignmentSimpleCharacterAlignment(IdGroup group, double[] traitValue, java.lang.String traitName)
Constructor for SimpleCharacterAlignment when there is only a single trait.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getEnvironmentName(int trait)
Return name of the environments for this trait numberint
getIdCount()
Returns the number of identifiers in this groupIdentifier
getIdentifier(int i)
Returns the ith identifier.int
getLength()
Return number of traits in this alignmentint
getSequenceCount()
Return number of taxa or sequences in this alignmentjava.lang.Object[]
getTableColumnNames()
Return column names for the tablejava.lang.Object[][]
getTableData()
Return data for the tablejava.lang.String
getTableTitle()
Return the name for the title of the ANOVAdouble
getTrait(int seq, int trait)
Return the trait value for a given sequence (taxon) and trait numberint
getTraitCount()
Return number of trait for each taxon in this alignmentjava.lang.String
getTraitName(int trait)
Return name of the trait for this trait numbervoid
report(java.io.PrintWriter out)
print human readable report (e.g., on parameters and associated model)void
setIdentifier(int i, Identifier ident)
Sets the ith identifier.java.lang.String
toString()
returns representation of this alignment as a stringint
whichIdNumber(java.lang.String name)
returns the index of the identifier with the given name.
-
-
-
Field Detail
-
traitValues
protected double[][] traitValues
trait values
-
traitNames
protected java.lang.String[] traitNames
names of the traits
-
environmentNames
protected java.lang.String[] environmentNames
names of the traits
-
numSeqs
protected int numSeqs
number of sequences
-
numTraits
protected int numTraits
number of traits
-
idGroup
protected IdGroup idGroup
sequence identifiers
-
-
Constructor Detail
-
SimpleCharacterAlignment
public SimpleCharacterAlignment()
-
SimpleCharacterAlignment
public SimpleCharacterAlignment(Identifier[] ids, double[][] traitValues, java.lang.String[] traitNames)
Constructor for SimpleCharacterAlignment. Environment names if be set to default NA.- Parameters:
group
- array of taxa identifierstraitValues
- matrix of trait valuestraitNames
- array of trait names
-
SimpleCharacterAlignment
public SimpleCharacterAlignment(IdGroup group, double[][] traitValues, java.lang.String[] traitNames)
Constructor for SimpleCharacterAlignment. Environment names if be set to default NA.- Parameters:
group
- taxa namestraitValues
- matrix of trait valuestraitNames
- array of trait names
-
SimpleCharacterAlignment
public SimpleCharacterAlignment(IdGroup group, double[][] traitValues, java.lang.String[] traitNames, java.lang.String[] environNames)
Constructor for SimpleCharacterAlignment- Parameters:
group
- taxa namestraitValues
- matrix of trait valuestraitNames
- array of trait namesenvironNames
- array of environment names
-
SimpleCharacterAlignment
public SimpleCharacterAlignment(IdGroup group, double[] traitValue, java.lang.String traitName)
Constructor for SimpleCharacterAlignment when there is only a single trait. Environment names if be set to default NA.- Parameters:
group
- holds taxa namestraitValue
- array of trait valuestraitName
- trait name
-
-
Method Detail
-
getTrait
public double getTrait(int seq, int trait)
Return the trait value for a given sequence (taxon) and trait number- Specified by:
getTrait
in interfaceCharacterAlignment
-
getLength
public final int getLength()
Return number of traits in this alignment
-
getSequenceCount
public final int getSequenceCount()
Return number of taxa or sequences in this alignment- Specified by:
getSequenceCount
in interfaceCharacterAlignment
-
getTraitCount
public final int getTraitCount()
Return number of trait for each taxon in this alignment- Specified by:
getTraitCount
in interfaceCharacterAlignment
-
getTraitName
public java.lang.String getTraitName(int trait)
Return name of the trait for this trait number- Specified by:
getTraitName
in interfaceCharacterAlignment
-
getEnvironmentName
public java.lang.String getEnvironmentName(int trait)
Return name of the environments for this trait number- Specified by:
getEnvironmentName
in interfaceCharacterAlignment
-
getIdentifier
public Identifier getIdentifier(int i)
Description copied from interface:IdGroup
Returns the ith identifier.- Specified by:
getIdentifier
in interfaceIdGroup
-
setIdentifier
public void setIdentifier(int i, Identifier ident)
Description copied from interface:IdGroup
Sets the ith identifier.- Specified by:
setIdentifier
in interfaceIdGroup
-
getIdCount
public int getIdCount()
Description copied from interface:IdGroup
Returns the number of identifiers in this group- Specified by:
getIdCount
in interfaceIdGroup
-
whichIdNumber
public int whichIdNumber(java.lang.String name)
Description copied from interface:IdGroup
returns the index of the identifier with the given name.- Specified by:
whichIdNumber
in interfaceIdGroup
-
toString
public java.lang.String toString()
returns representation of this alignment as a string- Overrides:
toString
in classjava.lang.Object
-
report
public void report(java.io.PrintWriter out)
Description copied from interface:Report
print human readable report (e.g., on parameters and associated model)
-
getTableColumnNames
public java.lang.Object[] getTableColumnNames()
Return column names for the table- Specified by:
getTableColumnNames
in interfaceTableReport
- Returns:
- columns names
-
getTableData
public java.lang.Object[][] getTableData()
Return data for the table- Specified by:
getTableData
in interfaceTableReport
- Returns:
- the data elements
-
getTableTitle
public java.lang.String getTableTitle()
Return the name for the title of the ANOVA- Specified by:
getTableTitle
in interfaceTableReport
- Returns:
- a String title
-
-