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 IdGroupsequence identifiersprotected intnumber of sequencesprotected intnumber 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 numberintReturns the number of identifiers in this groupgetIdentifier(int i) Returns the ith identifier.final intReturn number of traits in this alignmentfinal intReturn 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 ANOVAdoublegetTrait(int seq, int trait) Return the trait value for a given sequence (taxon) and trait numberfinal intReturn number of trait for each taxon in this alignmentgetTraitName(int trait) Return name of the trait for this trait numbervoidreport(PrintWriter out) print human readable report (e.g., on parameters and associated model)voidsetIdentifier(int i, Identifier ident) Sets the ith identifier.toString()returns representation of this alignment as a stringintwhichIdNumber(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:
group- array of taxa identifierstraitValues- matrix of trait valuestraitNames- array of trait names
-
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:
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
Return name of the trait for this trait number- Specified by:
getTraitNamein interfaceCharacterAlignment
-
getEnvironmentName
Return name of the environments for this trait number- Specified by:
getEnvironmentNamein interfaceCharacterAlignment
-
getIdentifier
Description copied from interface:IdGroupReturns the ith identifier.- Specified by:
getIdentifierin interfaceIdGroup
-
setIdentifier
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
Description copied from interface:IdGroupreturns the index of the identifier with the given name.- Specified by:
whichIdNumberin interfaceIdGroup
-
toString
returns representation of this alignment as a string -
report
Description copied from interface:Reportprint human readable report (e.g., on parameters and associated model) -
getTableColumnNames
Return column names for the table- Specified by:
getTableColumnNamesin interfaceTableReport- Returns:
- columns names
-
getTableData
Return data for the table- Specified by:
getTableDatain interfaceTableReport- Returns:
- the data elements
-
getTableTitle
Return the name for the title of the ANOVA- Specified by:
getTableTitlein interfaceTableReport- Returns:
- a String title
-