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[]environmentNamesnames of the traitsprotected IdGroupidGroupsequence identifiersprotected intnumSeqsnumber of sequencesprotected intnumTraitsnumber of traitsprotected java.lang.String[]traitNamesnames of the traitsprotected double[][]traitValuestrait 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.StringgetEnvironmentName(int trait)Return name of the environments for this trait numberintgetIdCount()Returns the number of identifiers in this groupIdentifiergetIdentifier(int i)Returns the ith identifier.intgetLength()Return number of traits in this alignmentintgetSequenceCount()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.StringgetTableTitle()Return the name for the title of the ANOVAdoublegetTrait(int seq, int trait)Return the trait value for a given sequence (taxon) and trait numberintgetTraitCount()Return number of trait for each taxon in this alignmentjava.lang.StringgetTraitName(int trait)Return name of the trait for this trait numbervoidreport(java.io.PrintWriter out)print human readable report (e.g., on parameters and associated model)voidsetIdentifier(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
-
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:
getTraitin 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:
getSequenceCountin interfaceCharacterAlignment
-
getTraitCount
public final int getTraitCount()
Return number of trait for each taxon in this alignment- Specified by:
getTraitCountin interfaceCharacterAlignment
-
getTraitName
public java.lang.String getTraitName(int trait)
Return name of the trait for this trait number- Specified by:
getTraitNamein interfaceCharacterAlignment
-
getEnvironmentName
public java.lang.String getEnvironmentName(int trait)
Return name of the environments for this trait number- Specified by:
getEnvironmentNamein interfaceCharacterAlignment
-
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
-
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)
-
getTableColumnNames
public java.lang.Object[] getTableColumnNames()
Return column names for the table- Specified by:
getTableColumnNamesin interfaceTableReport- Returns:
- columns names
-
getTableData
public java.lang.Object[][] getTableData()
Return data for the table- Specified by:
getTableDatain interfaceTableReport- Returns:
- the data elements
-
getTableTitle
public java.lang.String getTableTitle()
Return the name for the title of the ANOVA- Specified by:
getTableTitlein interfaceTableReport- Returns:
- a String title
-
-