Package pal.alignment
Class SimpleCharacterAlignment
java.lang.Object
pal.alignment.SimpleCharacterAlignment
- All Implemented Interfaces:
Serializable
,CharacterAlignment
,IdGroup
,Report
,TableReport
public class SimpleCharacterAlignment
extends Object
implements CharacterAlignment, 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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface pal.misc.IdGroup
IdGroup.Utils
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]
names of the traitsprotected IdGroup
sequence identifiersprotected int
number of sequencesprotected int
number of traitsprotected String[]
names of the traitsprotected double[][]
trait valuesFields inherited from interface pal.alignment.CharacterAlignment
MISSING
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleCharacterAlignment
(Identifier[] ids, double[][] traitValues, String[] traitNames) Constructor for SimpleCharacterAlignment.SimpleCharacterAlignment
(IdGroup group, double[][] traitValues, String[] traitNames) Constructor for SimpleCharacterAlignment.SimpleCharacterAlignment
(IdGroup group, double[][] traitValues, String[] traitNames, String[] environNames) Constructor for SimpleCharacterAlignmentSimpleCharacterAlignment
(IdGroup group, double[] traitValue, String traitName) Constructor for SimpleCharacterAlignment when there is only a single trait. -
Method Summary
Modifier and TypeMethodDescriptiongetEnvironmentName
(int trait) Return name of the environments for this trait numberint
Returns the number of identifiers in this groupgetIdentifier
(int i) Returns the ith identifier.final int
Return number of traits in this alignmentfinal int
Return number of taxa or sequences in this alignmentObject[]
Return column names for the tableObject[][]
Return data for the tableReturn the name for the title of the ANOVAdouble
getTrait
(int seq, int trait) Return the trait value for a given sequence (taxon) and trait numberfinal int
Return number of trait for each taxon in this alignmentgetTraitName
(int trait) Return name of the trait for this trait numbervoid
report
(PrintWriter out) print human readable report (e.g., on parameters and associated model)void
setIdentifier
(int i, Identifier ident) Sets the ith identifier.toString()
returns representation of this alignment as a stringint
whichIdNumber
(String name) returns the index of the identifier with the given name.
-
Field Details
-
traitValues
protected double[][] traitValuestrait values -
traitNames
names of the traits -
environmentNames
names of the traits -
numSeqs
protected int numSeqsnumber of sequences -
numTraits
protected int numTraitsnumber of traits -
idGroup
sequence identifiers
-
-
Constructor Details
-
SimpleCharacterAlignment
public SimpleCharacterAlignment() -
SimpleCharacterAlignment
Constructor for SimpleCharacterAlignment. Environment names if be set to default NA.- Parameters:
traitValues
- matrix of trait valuestraitNames
- array of trait namesgroup
- array of taxa identifiers
-
SimpleCharacterAlignment
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, String[] traitNames, String[] environNames) Constructor for SimpleCharacterAlignment- Parameters:
group
- taxa namestraitValues
- matrix of trait valuestraitNames
- array of trait namesenvironNames
- array of environment names
-
SimpleCharacterAlignment
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 Details
-
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
Return name of the trait for this trait number- Specified by:
getTraitName
in interfaceCharacterAlignment
-
getEnvironmentName
Return name of the environments for this trait number- Specified by:
getEnvironmentName
in interfaceCharacterAlignment
-
getIdentifier
Description copied from interface:IdGroup
Returns the ith identifier.- Specified by:
getIdentifier
in interfaceIdGroup
-
setIdentifier
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
Description copied from interface:IdGroup
returns the index of the identifier with the given name.- Specified by:
whichIdNumber
in interfaceIdGroup
-
toString
returns representation of this alignment as a string -
report
Description copied from interface:Report
print human readable report (e.g., on parameters and associated model) -
getTableColumnNames
Return column names for the table- Specified by:
getTableColumnNames
in interfaceTableReport
- Returns:
- columns names
-
getTableData
Return data for the table- Specified by:
getTableData
in interfaceTableReport
- Returns:
- the data elements
-
getTableTitle
Return the name for the title of the ANOVA- Specified by:
getTableTitle
in interfaceTableReport
- Returns:
- a String title
-