Package pal.alignment

Class 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
    • 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 number
      int getIdCount()
      Returns the number of identifiers in this group
      Identifier getIdentifier​(int i)
      Returns the ith identifier.
      int getLength()
      Return number of traits in this alignment
      int getSequenceCount()
      Return number of taxa or sequences in this alignment
      java.lang.Object[] getTableColumnNames()
      Return column names for the table
      java.lang.Object[][] getTableData()
      Return data for the table
      java.lang.String getTableTitle()
      Return the name for the title of the ANOVA
      double getTrait​(int seq, int trait)
      Return the trait value for a given sequence (taxon) and trait number
      int getTraitCount()
      Return number of trait for each taxon in this alignment
      java.lang.String getTraitName​(int trait)
      Return name of the trait for this trait number
      void 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 string
      int whichIdNumber​(java.lang.String name)
      returns the index of the identifier with the given name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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 identifiers
        traitValues - matrix of trait values
        traitNames - 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 names
        traitValues - matrix of trait values
        traitNames - 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 names
        traitValues - matrix of trait values
        traitNames - array of trait names
        environNames - 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 names
        traitValue - array of trait values
        traitName - 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 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 java.lang.String getTraitName​(int trait)
        Return name of the trait for this trait number
        Specified by:
        getTraitName in interface CharacterAlignment
      • getEnvironmentName

        public java.lang.String getEnvironmentName​(int trait)
        Return name of the environments for this trait number
        Specified by:
        getEnvironmentName in interface CharacterAlignment
      • 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​(java.lang.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 java.lang.String toString()
        returns representation of this alignment as a string
        Overrides:
        toString in class java.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)
        Specified by:
        report in interface Report
        Parameters:
        out - output stream
      • getTableColumnNames

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

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

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