Class GeneralREVRateMatrix

java.lang.Object
pal.substmodel.GeneralREVRateMatrix
All Implemented Interfaces:
Serializable, NeoRateMatrix

public class GeneralREVRateMatrix extends Object implements NeoRateMatrix
A general rate matrix class for REV style rate matrices (GTR but for all data types) Includes the ability for arbitarily constraints
Author:
Matthew Goode
  • 11 May 2004 - Created file - will add parameter decoding and reporting later...
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    GeneralREVRateMatrix(int dimension)
    The general constructor for a fully specified REV model
    GeneralREVRateMatrix(int dimension, double[] specifiedDefaultParameters)
    The general constructor for a fully specified REV model
    GeneralREVRateMatrix(int dimension, int[] constraints)
    The general constructor
    Constraint ordering example, for nucleotide data -> + A C G T A * 0 1 2 C * * 3 4 G * * * 5 T * * * * if constraints were {0,1,1,0,0,1} then would be constrained so a-c = c-g = c-t and a-g = a-t = g-t (and there would be only one parameter)
    GeneralREVRateMatrix(int dimension, int[] constraints, double[] specifiedDefaultParameters)
    The general constructor
    Constraint ordering example, for nucleotide data -> + A C G T A * 0 1 2 C * * 3 4 G * * * 5 T * * * * if constraints were {0,1,1,0,0,1} then would be constrained so a-c = c-g = c-t and a-g = a-t = g-t (and there would be only one parameter)
    GeneralREVRateMatrix(int dimension, int[] constraints, double[] specifiedDefaultParameters, int fixedConstraintValue)
    The general constructor
    Constraint ordering example, for nucleotide data -> + A C G T A * 0 1 2 C * * 3 4 G * * * 5 T * * * * if constraints were {0,1,1,0,0,1} then would be constrained so a-c = c-g = c-t and a-g = a-t = g-t (and there would be only one parameter)
  • Method Summary

    Modifier and Type
    Method
    Description
    Create a rate matrix equivalent to the GTR model
    createGTR(double[] defaultParameters)
    Create a rate matrix equivalent to the GTR model
    createGTR(double a, double b, double c, double d, double e)
    Create a rate matrix equivalent to the GTR model Parameters laid out * -> + A C G T A * a b c C * * d e G * * * 1 T * * * *
    Create a rate matrix equivalent to the HKY model, the one parameter will be kappa
    createHKY(double defaultKappa)
    Create a rate matrix equivalent to the HKY model, the one parameter will be kappa
    void
    createRelativeRates(double[][] rateStore, double[] rateParameters, int startIndex)
    Create the relative rates array
    void
    getDefaultRateParameters(double[] store, int startIndex)
     
    int
     
    int
     
    double
     
    double
     
     
    boolean
    Check the compatibility of a data type to be used with the rate matrix
    boolean
    Is the relative rate matrix described by this rate matrix meant to represent a reversible process? If true only the upper part of the rate matrix needs to be filled in (eg in matrix[i][j], for all where j > i );

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GeneralREVRateMatrix

      public GeneralREVRateMatrix(int dimension)
      The general constructor for a fully specified REV model
      Parameters:
      dimension - the dimension of the data type
    • GeneralREVRateMatrix

      public GeneralREVRateMatrix(int dimension, double[] specifiedDefaultParameters)
      The general constructor for a fully specified REV model
      Parameters:
      dimension - the dimension of the data type
      specifiedDefaultParameters - the defaultParameters (potentially used as the starting parameters by a SubstitutionModel)
    • GeneralREVRateMatrix

      public GeneralREVRateMatrix(int dimension, int[] constraints)
      The general constructor
      Constraint ordering example, for nucleotide data -> + A C G T A * 0 1 2 C * * 3 4 G * * * 5 T * * * * if constraints were {0,1,1,0,0,1} then would be constrained so a-c = c-g = c-t and a-g = a-t = g-t (and there would be only one parameter)
      Parameters:
      dimension - the dimension of the data type
      constraints - the contraints, organised such that if constraints[i]==constraints[j] then transitions i and j will always be the same. The constraints are ordered like usual.
    • GeneralREVRateMatrix

      public GeneralREVRateMatrix(int dimension, int[] constraints, double[] specifiedDefaultParameters)
      The general constructor
      Constraint ordering example, for nucleotide data -> + A C G T A * 0 1 2 C * * 3 4 G * * * 5 T * * * * if constraints were {0,1,1,0,0,1} then would be constrained so a-c = c-g = c-t and a-g = a-t = g-t (and there would be only one parameter)
      Parameters:
      dimension - the dimension of the data type
      constraints - the contraints, organised such that if constraints[i]==constraints[j] then transitions i and j will always be the same. The constraints are ordered like usual. The last constrained item is fixed at 1.
      specifiedDefaultParameters - the defaultParameters (potentially used as the starting parameters by a SubstitutionModel)
    • GeneralREVRateMatrix

      public GeneralREVRateMatrix(int dimension, int[] constraints, double[] specifiedDefaultParameters, int fixedConstraintValue)
      The general constructor
      Constraint ordering example, for nucleotide data -> + A C G T A * 0 1 2 C * * 3 4 G * * * 5 T * * * * if constraints were {0,1,1,0,0,1} then would be constrained so a-c = c-g = c-t and a-g = a-t = g-t (and there would be only one parameter)
      Parameters:
      dimension - the dimension of the data type
      constraints - the contraints, organised such that if constraints[i]==constraints[j] then transitions i and j will always be the same. The constraints are ordered like usual.
      specifiedDefaultParameters - the defaultParameters (potentially used as the starting parameters by a SubstitutionModel)
      fixedConstraintValue - the value of the constraint (in the constraints array) of the fixed constraint (that is, for which all related parts of the rate matrix are set to 1)
  • Method Details

    • getUniqueName

      public String getUniqueName()
      Specified by:
      getUniqueName in interface NeoRateMatrix
      Returns:
      a short unique human-readable identifier for this rate matrix.
    • isReversible

      public boolean isReversible()
      Description copied from interface: NeoRateMatrix
      Is the relative rate matrix described by this rate matrix meant to represent a reversible process? If true only the upper part of the rate matrix needs to be filled in (eg in matrix[i][j], for all where j > i );
      Specified by:
      isReversible in interface NeoRateMatrix
      Returns:
      true
    • getDimension

      public int getDimension()
      Specified by:
      getDimension in interface NeoRateMatrix
      Returns:
      the dimension of this rate matrix. (as for construction)
    • isDataTypeCompatible

      public boolean isDataTypeCompatible(DataType dt)
      Check the compatibility of a data type to be used with the rate matrix
      Specified by:
      isDataTypeCompatible in interface NeoRateMatrix
      Parameters:
      dt - the data type to test
      Returns:
      true if data type state count is equal to dimension
    • createRelativeRates

      public void createRelativeRates(double[][] rateStore, double[] rateParameters, int startIndex)
      Description copied from interface: NeoRateMatrix
      Create the relative rates array
      Specified by:
      createRelativeRates in interface NeoRateMatrix
      Parameters:
      rateStore - The place where the relative rates are stored (should be assumed to be large enough - based on dimension)
      rateParameters - The parameters to be used to construct the rate store
      startIndex - The index into the rateParameters to start reading parameters
    • getNumberOfRateParameters

      public int getNumberOfRateParameters()
      Specified by:
      getNumberOfRateParameters in interface NeoRateMatrix
    • getRateParameterLowerBound

      public double getRateParameterLowerBound(int parameter)
      Specified by:
      getRateParameterLowerBound in interface NeoRateMatrix
    • getRateParameterUpperBound

      public double getRateParameterUpperBound(int parameter)
      Specified by:
      getRateParameterUpperBound in interface NeoRateMatrix
    • getDefaultRateParameters

      public void getDefaultRateParameters(double[] store, int startIndex)
      Specified by:
      getDefaultRateParameters in interface NeoRateMatrix
    • createGTR

      public static final GeneralREVRateMatrix createGTR()
      Create a rate matrix equivalent to the GTR model
      Returns:
      appropriate rate matrix
    • createGTR

      public static final GeneralREVRateMatrix createGTR(double[] defaultParameters)
      Create a rate matrix equivalent to the GTR model
      Parameters:
      defaultParameters - the default parameters of the model
      Returns:
      appropriate rate matrix
    • createGTR

      public static final GeneralREVRateMatrix createGTR(double a, double b, double c, double d, double e)
      Create a rate matrix equivalent to the GTR model Parameters laid out * -> + A C G T A * a b c C * * d e G * * * 1 T * * * *
      Parameters:
      a - the default a parameter of the model
      b - the default a parameter of the model
      c - the default a parameter of the model
      d - the default a parameter of the model
      e - the default a parameter of the model
      Returns:
      appropriate rate matrix
    • createHKY

      public static final GeneralREVRateMatrix createHKY()
      Create a rate matrix equivalent to the HKY model, the one parameter will be kappa
      Returns:
      appropriate rate matrix
    • createHKY

      public static final GeneralREVRateMatrix createHKY(double defaultKappa)
      Create a rate matrix equivalent to the HKY model, the one parameter will be kappa
      Parameters:
      defaultKappa - the default kappa value
      Returns:
      appropriate rate matrix