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:
  • Field Details

    • traitValues

      protected double[][] traitValues
      trait values
    • traitNames

      protected String[] traitNames
      names of the traits
    • environmentNames

      protected 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 Details

    • SimpleCharacterAlignment

      public SimpleCharacterAlignment()
    • SimpleCharacterAlignment

      public SimpleCharacterAlignment(Identifier[] ids, double[][] traitValues, String[] traitNames)
      Constructor for SimpleCharacterAlignment. Environment names if be set to default NA.
      Parameters:
      traitValues - matrix of trait values
      traitNames - array of trait names
      group - array of taxa identifiers
    • SimpleCharacterAlignment

      public SimpleCharacterAlignment(IdGroup group, double[][] traitValues, String[] traitNames)
      Constructor for SimpleCharacterAlignment. Environment names if be set to default NA.
      Parameters:
      group - taxa names
      traitValues - matrix of trait values
      traitNames - array of trait names
    • SimpleCharacterAlignment

      public SimpleCharacterAlignment(IdGroup group, double[][] traitValues, String[] traitNames, String[] environNames)
      Constructor for SimpleCharacterAlignment
      Parameters:
      group - taxa names
      traitValues - matrix of trait values
      traitNames - array of trait names
      environNames - array of environment names
    • SimpleCharacterAlignment

      public SimpleCharacterAlignment(IdGroup group, double[] traitValue, String traitName)
      Constructor for SimpleCharacterAlignment when there is only a single trait. Environment names if be set to default NA.
      Parameters:
      group - holds taxa names
      traitValue - array of trait values
      traitName - 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 interface CharacterAlignment
    • 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 interface CharacterAlignment
    • getTraitCount

      public final int getTraitCount()
      Return number of trait for each taxon in this alignment
      Specified by:
      getTraitCount in interface CharacterAlignment
    • getTraitName

      public String getTraitName(int trait)
      Return name of the trait for this trait number
      Specified by:
      getTraitName in interface CharacterAlignment
    • getEnvironmentName

      public String getEnvironmentName(int trait)
      Return name of the environments for this trait number
      Specified by:
      getEnvironmentName in interface CharacterAlignment
    • getIdentifier

      public Identifier getIdentifier(int i)
      Description copied from interface: IdGroup
      Returns the ith identifier.
      Specified by:
      getIdentifier in interface IdGroup
    • setIdentifier

      public void setIdentifier(int i, Identifier ident)
      Description copied from interface: IdGroup
      Sets the ith identifier.
      Specified by:
      setIdentifier in interface IdGroup
    • getIdCount

      public int getIdCount()
      Description copied from interface: IdGroup
      Returns the number of identifiers in this group
      Specified by:
      getIdCount in interface IdGroup
    • whichIdNumber

      public int whichIdNumber(String name)
      Description copied from interface: IdGroup
      returns the index of the identifier with the given name.
      Specified by:
      whichIdNumber in interface IdGroup
    • toString

      public String toString()
      returns representation of this alignment as a string
      Overrides:
      toString in class Object
    • report

      public void report(PrintWriter out)
      Description copied from interface: Report
      print human readable report (e.g., on parameters and associated model)
      Specified by:
      report in interface Report
      Parameters:
      out - output stream
    • getTableColumnNames

      public Object[] getTableColumnNames()
      Return column names for the table
      Specified by:
      getTableColumnNames in interface TableReport
      Returns:
      columns names
    • getTableData

      public Object[][] getTableData()
      Return data for the table
      Specified by:
      getTableData in interface TableReport
      Returns:
      the data elements
    • getTableTitle

      public String getTableTitle()
      Return the name for the title of the ANOVA
      Specified by:
      getTableTitle in interface TableReport
      Returns:
      a String title