Package pal.mep
Class SteppedMutationRate
- java.lang.Object
-
- pal.mep.MutationRateModel
-
- pal.mep.SteppedMutationRate
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,Parameterized
,Report
,Summarizable
,Units
public class SteppedMutationRate extends MutationRateModel implements Report, Summarizable, Parameterized, java.io.Serializable
This class models a step-wise mutation rate.
parameters:
mus[] = vector of mutation rates
muChanges[] = vector of change timesDrummond, Forsberg and Rodrigo (2001). The inference of step-wise changes in substitution rates using serial sequence samples. accepted in MBE.
- Version:
- $Id: SteppedMutationRate.java,v 1.13 2004/10/18 03:45:17 matt Exp $
- Author:
- Alexei Drummond
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class pal.mep.MutationRateModel
MutationRateModel.Factory
-
Nested classes/interfaces inherited from interface pal.misc.Parameterized
Parameterized.Null, Parameterized.ParameterizedBase, Parameterized.ParameterizedUser, Parameterized.Utils
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
INVALID_INTERVALS_TEXT
static java.lang.String
MAX_TIME_IS_TEXT
static java.lang.String
NEGATIVE_VALUES_TEXT
static java.lang.String
REPEATED_TIMES_TEXT
static java.lang.String
ZERO_TIME_TEXT
-
Fields inherited from class pal.mep.MutationRateModel
fo
-
Fields inherited from interface pal.misc.Units
DAYS, EXPECTED_SUBSTITUTIONS, GENERATIONS, MONTHS, SAMPLE, SHORT_UNIT_NAMES, UNIT_NAMES, UNKNOWN, YEARS
-
-
Constructor Summary
Constructors Constructor Description SteppedMutationRate(double[] rates, double[] muChanges, int units, boolean fixed, double maximumMutationRate)
Construct mutation rate model of a give rate in given units.SteppedMutationRate(double[] rates, double[] muChanges, int units, double maximumMutationRate)
Construct mutation rate model of a give rate in given units.SteppedMutationRate(double[] muChanges, int units, double maximumMutationRate)
Construct demographic model with default settingsSteppedMutationRate(double[] rates, TimeOrderCharacterData timeInfo)
Construct mutation rate model of a give rate in given units.SteppedMutationRate(double[] rates, TimeOrderCharacterData timeInfo, boolean fixed)
Construct mutation rate model of a give rate in given units.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
checkMuChanges(boolean allowEstimationOutsideSamplingTimes, double[] muChanges, boolean sortMuChanges, double[] sampleTimes, boolean sortSampleTimes)
Checks if mu changes are valid for a particular set of sample times.java.lang.Object
clone()
MutationRateModel.Factory
generateFactory()
MutationRateModel
getCopy()
double
getDefaultValue(int k)
get default value of parameterdouble[]
getDeltas(double[] times)
double
getEndTime(double expectedSubs, double startTime)
Return the end time at which expected substitutions has occurred, given we start at start timedouble
getExpectedSubstitutions(double time)
Returns integral of mutation rate function (= integral mu(x) dx from 0 to t).static MutationRateModel.Factory
getFactory(double[] rates, double[] muChanges, int units, double maximumMutationRate)
Generate a MutationRateModel.Factory class for a SteppedMutationRatestatic MutationRateModel.Factory
getFactory(double[] muChanges, int units, double maximumMutationRate)
Generate a MutationRateModel.Factory class for a SteppedMutationRatestatic MutationRateModel.Factory
getFactory(double[] muChanges, TimeOrderCharacterData tocd)
Generate a MutationRateModel.Factory class for a SteppedMutationRatedouble
getLowerLimit(int k)
get lower parameter limitdouble
getMu()
returns current day mutation rate.double[]
getMuChanges()
double[]
getMus()
void
getMus(double[] muStore)
double
getMutationRate(double t)
Gets the mutation rate, value of mu(t) at time t.int
getNumParameters()
get number of parametersdouble
getParameter(int k)
get model parameterjava.lang.String[]
getSummaryTypes()
double
getSummaryValue(int summaryType)
static double[]
getTimeIntervals(double[] muChanges, double smallTime, double bigTime)
double
getUpperLimit(int k)
get upper parameter limitvoid
report(java.io.PrintWriter out)
print human readable report (e.g., on parameters and associated model)void
scale(double scale)
Linearly scales this mutation rate model.void
setMu(double m)
void
setParameter(double value, int k)
set model parametervoid
setParameterSE(double value, int k)
set standard errors for model parameterjava.lang.String
toSingleLine()
java.lang.String
toString()
-
Methods inherited from class pal.mep.MutationRateModel
getExpectedSubstitutions, getMaximumMutationRate, getOrthogonalHints, getTime, getUnits, scale, setUnits
-
-
-
-
Field Detail
-
REPEATED_TIMES_TEXT
public static final java.lang.String REPEATED_TIMES_TEXT
- See Also:
- Constant Field Values
-
NEGATIVE_VALUES_TEXT
public static final java.lang.String NEGATIVE_VALUES_TEXT
- See Also:
- Constant Field Values
-
MAX_TIME_IS_TEXT
public static final java.lang.String MAX_TIME_IS_TEXT
- See Also:
- Constant Field Values
-
ZERO_TIME_TEXT
public static final java.lang.String ZERO_TIME_TEXT
- See Also:
- Constant Field Values
-
INVALID_INTERVALS_TEXT
public static final java.lang.String INVALID_INTERVALS_TEXT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SteppedMutationRate
public SteppedMutationRate(double[] muChanges, int units, double maximumMutationRate)
Construct demographic model with default settings
-
SteppedMutationRate
public SteppedMutationRate(double[] rates, double[] muChanges, int units, double maximumMutationRate)
Construct mutation rate model of a give rate in given units.- Parameters:
rates
- The initial values of the rates (this array is used for storing the rates)muChanges
- The times for when the mutation rate can changemaximumMutationRate
- The maximum mutation rate (1 is a good value...)
-
SteppedMutationRate
public SteppedMutationRate(double[] rates, double[] muChanges, int units, boolean fixed, double maximumMutationRate)
Construct mutation rate model of a give rate in given units.- Parameters:
fixed
- if true the mutation rates are set and are not parametersrates
- The initial values of the rates (this array is used for storing the rates)muChanges
- The times for when the mutation rate can changemaximumMutationRate
- The maximum mutation rate (related to how much difference there is between samples, max mu*time diff ~= 1 is a good estimate...)
-
SteppedMutationRate
public SteppedMutationRate(double[] rates, TimeOrderCharacterData timeInfo)
Construct mutation rate model of a give rate in given units.- Parameters:
rates
- The initial values of the rates (this array is used for storing the rates)timeInfo
- the sample information object that relates times to sequences. Will extract the mu change information from this input, such that the mutation rate changes at each sample point
-
SteppedMutationRate
public SteppedMutationRate(double[] rates, TimeOrderCharacterData timeInfo, boolean fixed)
Construct mutation rate model of a give rate in given units.- Parameters:
fixed
- if true the mutation rates are set and are not parametersrates
- The initial values of the rates (this array is used for storing the rates)timeInfo
- the sample information object that relates times to sequences. Will extract the mu change information from this input, such that the mutation rate changes at each sample point
-
-
Method Detail
-
clone
public java.lang.Object clone()
- Specified by:
clone
in classMutationRateModel
-
getCopy
public MutationRateModel getCopy()
- Specified by:
getCopy
in classMutationRateModel
-
getSummaryTypes
public java.lang.String[] getSummaryTypes()
- Specified by:
getSummaryTypes
in interfaceSummarizable
-
getSummaryValue
public double getSummaryValue(int summaryType)
- Specified by:
getSummaryValue
in interfaceSummarizable
-
getMu
public double getMu()
returns current day mutation rate.
-
setMu
public void setMu(double m)
-
getMus
public void getMus(double[] muStore)
-
getMutationRate
public final double getMutationRate(double t)
Description copied from class:MutationRateModel
Gets the mutation rate, value of mu(t) at time t.- Specified by:
getMutationRate
in classMutationRateModel
-
getExpectedSubstitutions
public final double getExpectedSubstitutions(double time)
Description copied from class:MutationRateModel
Returns integral of mutation rate function (= integral mu(x) dx from 0 to t).- Specified by:
getExpectedSubstitutions
in classMutationRateModel
-
getEndTime
public final double getEndTime(double expectedSubs, double startTime)
Description copied from class:MutationRateModel
Return the end time at which expected substitutions has occurred, given we start at start time- Specified by:
getEndTime
in classMutationRateModel
-
scale
public final void scale(double scale)
Linearly scales this mutation rate model.- Specified by:
scale
in classMutationRateModel
- Parameters:
scale
- getExpectedSubstitutions should return scale instead of 1.0 at time t.
-
getTimeIntervals
public static double[] getTimeIntervals(double[] muChanges, double smallTime, double bigTime)
-
getDeltas
public double[] getDeltas(double[] times)
-
getNumParameters
public int getNumParameters()
Description copied from interface:Parameterized
get number of parameters- Specified by:
getNumParameters
in interfaceParameterized
- Returns:
- number of parameters
-
getParameter
public double getParameter(int k)
Description copied from interface:Parameterized
get model parameter- Specified by:
getParameter
in interfaceParameterized
- Parameters:
k
- parameter number- Returns:
- parameter value
-
getUpperLimit
public double getUpperLimit(int k)
Description copied from interface:Parameterized
get upper parameter limit- Specified by:
getUpperLimit
in interfaceParameterized
- Parameters:
k
- parameter number- Returns:
- upper bound
-
getLowerLimit
public double getLowerLimit(int k)
Description copied from interface:Parameterized
get lower parameter limit- Specified by:
getLowerLimit
in interfaceParameterized
- Parameters:
k
- parameter number- Returns:
- lower bound
-
getDefaultValue
public double getDefaultValue(int k)
Description copied from interface:Parameterized
get default value of parameter- Specified by:
getDefaultValue
in interfaceParameterized
- Parameters:
k
- parameter number- Returns:
- default value
-
setParameter
public void setParameter(double value, int k)
Description copied from interface:Parameterized
set model parameter- Specified by:
setParameter
in interfaceParameterized
- Parameters:
value
- parameter valuek
- parameter number
-
setParameterSE
public void setParameterSE(double value, int k)
Description copied from interface:Parameterized
set standard errors for model parameter- Specified by:
setParameterSE
in interfaceParameterized
- Parameters:
value
- standard error of parameter valuek
- parameter number
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.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)
-
getMus
public double[] getMus()
-
getMuChanges
public final double[] getMuChanges()
-
toSingleLine
public java.lang.String toSingleLine()
- Specified by:
toSingleLine
in classMutationRateModel
-
generateFactory
public MutationRateModel.Factory generateFactory()
- Specified by:
generateFactory
in classMutationRateModel
-
getFactory
public static final MutationRateModel.Factory getFactory(double[] muChanges, int units, double maximumMutationRate)
Generate a MutationRateModel.Factory class for a SteppedMutationRate
-
getFactory
public static final MutationRateModel.Factory getFactory(double[] rates, double[] muChanges, int units, double maximumMutationRate)
Generate a MutationRateModel.Factory class for a SteppedMutationRate
-
getFactory
public static final MutationRateModel.Factory getFactory(double[] muChanges, TimeOrderCharacterData tocd)
Generate a MutationRateModel.Factory class for a SteppedMutationRate
-
checkMuChanges
public static final java.lang.String checkMuChanges(boolean allowEstimationOutsideSamplingTimes, double[] muChanges, boolean sortMuChanges, double[] sampleTimes, boolean sortSampleTimes)
Checks if mu changes are valid for a particular set of sample times.- Returns:
- null if muChanges okay, or a message describing what is wrong.
The things that may be a problem are
- There is a negative muChange time
- There is a repeated muChange time
- There are two or more muChange intervals with in a sample interval that do not overlap with another sample interval (this makes it impossible to infer anything between the separate intervals)
-
-