Simulations
Class Simulate

java.lang.Object
  extended by Simulations.Simulate

public class Simulate
extends java.lang.Object

Class for constructing simulated data

Version:
1.0

Constructor Summary
Simulate(Model m, Tree t, Parameters p)
          Creates an object to simulate data for a given model, tree and parameters.
Simulate(Model m, Tree t, Parameters p, Alignment unobserved)
          Creates an object to simulate data for a given model, tree, parameters and unobserved states.
Simulate(Model m, Tree t, Parameters p, Alignment unobserved, Constrainer con)
          Creates an object to simulate data for a given model, tree, parameters, unobserved states and constraints.
 
Method Summary
 Alignment getAlignment(int length)
          Gets a simulated alignment, not returing the state of internal nodes
 Alignment getAlignment(int length, boolean internal)
          Gets a simulated alignment
 Alignment getAlignment(int length, boolean internal, java.util.Map<java.lang.String,java.lang.String> recode)
          Gets a simulated alignment.
 Alignment getAlignment(int length, java.util.Map<java.lang.String,java.lang.String> recode)
          Gets a simulated alignment, not returing the state of internal nodes.
 Site getSite()
          Gets a simulated site without returning the state of the internal nodes
 Site getSite(boolean internal)
          Gets a simulated site
 Site getSite(boolean internal, java.util.Map<java.lang.String,java.lang.String> recode)
          Gets a simulated site.
 Site getSite(java.util.Map<java.lang.String,java.lang.String> recode)
          Gets a simulated site without returning the state of the internal nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Simulate

public Simulate(Model m,
                Tree t,
                Parameters p)
         throws RateCategory.RateException,
                Model.ModelException,
                TreeException,
                Parameters.ParameterException
Creates an object to simulate data for a given model, tree and parameters. Has no unobserved states.

Parameters:
m - The model
t - The tree
p - The parameters
Throws:
RateCategory.RateException - Thrown if there is an issue with a rate category in the model (e.g. a badly formatted rate).
Model.ModelException - Thrown if there is a problem with the model (e.g. the rate categories differ in their states)
TreeException - Thrown if there is a problem with the tree.
Parameters.ParameterException - Thrown if there is a problem with the parameters (e.g. a requied parameter is not present)

Simulate

public Simulate(Model m,
                Tree t,
                Parameters p,
                Alignment unobserved)
         throws RateCategory.RateException,
                Model.ModelException,
                TreeException,
                Parameters.ParameterException
Creates an object to simulate data for a given model, tree, parameters and unobserved states.

Parameters:
m - The model
t - The tree
p - The parameters
unobserved - The unobserved states
Throws:
RateCategory.RateException - Thrown if there is an issue with a rate category in the model (e.g. a badly formatted rate).
Model.ModelException - Thrown if there is a problem with the model (e.g. the rate categories differ in their states)
TreeException - Thrown if there is a problem with the tree.
Parameters.ParameterException - Thrown if there is a problem with the parameters (e.g. a requied parameter is not present)

Simulate

public Simulate(Model m,
                Tree t,
                Parameters p,
                Alignment unobserved,
                Constrainer con)
         throws RateCategory.RateException,
                Model.ModelException,
                TreeException,
                Parameters.ParameterException
Creates an object to simulate data for a given model, tree, parameters, unobserved states and constraints. If a site is generated that does not meet the constraints then it is discarded and a new site generated.

Parameters:
m - The model
t - The tree
p - The parameters
unobserved - The unobserved states
con - The constraints
Throws:
RateCategory.RateException - Thrown if there is an issue with a rate category in the model (e.g. a badly formatted rate).
Model.ModelException - Thrown if there is a problem with the model (e.g. the rate categories differ in their states)
TreeException - Thrown if there is a problem with the tree.
Parameters.ParameterException - Thrown if there is a problem with the parameters (e.g. a requied parameter is not present)
Method Detail

getSite

public Site getSite()
             throws TreeException
Gets a simulated site without returning the state of the internal nodes

Returns:
The simulated site
Throws:
TreeException - Thrown if the constrainer has a problem with the tree

getSite

public Site getSite(java.util.Map<java.lang.String,java.lang.String> recode)
             throws TreeException
Gets a simulated site without returning the state of the internal nodes. Recodes the simulated data before returning. For example if both "A" and "B" are unobserved states representing an observed state of "0" then this can be used to change "A" and "B" to zero. This is neccessay as the simulator generates unobserved states by default. The returned site will have ambiguous data set as appropiate.

Parameters:
recode - Map of recodings
Returns:
The simulated site
Throws:
TreeException - Thrown if the constrainer has a problem with the tree

getSite

public Site getSite(boolean internal)
             throws TreeException
Gets a simulated site

Parameters:
internal - Whether to return the state of the internal nodes
Returns:
The simulated site
Throws:
TreeException - Thrown if the constrainer has a problem with the tree

getSite

public Site getSite(boolean internal,
                    java.util.Map<java.lang.String,java.lang.String> recode)
             throws TreeException
Gets a simulated site. Recodes the simulated data before returning. For example if both "A" and "B" are unobserved states representing an observed state of "0" then this can be used to change "A" and "B" to zero. This is neccessay as the simulator generates unobserved states by default. The returned site will have ambiguous data set as appropiate.

Parameters:
recode - Map of recodings
internal - Whether to return the state of the internal nodes
Returns:
The simulated site
Throws:
TreeException - Thrown if the constrainer has a problem with the tree

getAlignment

public Alignment getAlignment(int length)
                       throws AlignmentException,
                              TreeException
Gets a simulated alignment, not returing the state of internal nodes

Parameters:
length - The length of the alignment
Returns:
The simulated alignment
Throws:
AlignmentException - Thrown if there is a problem with the alignment
TreeException - Thrown if the constrainer has a problem with the tree

getAlignment

public Alignment getAlignment(int length,
                              boolean internal)
                       throws AlignmentException,
                              TreeException
Gets a simulated alignment

Parameters:
length - The length of the alignment
internal - Whether to return the state of the internal nodes
Returns:
The simulated alignment
Throws:
AlignmentException - Thrown if there is a problem with the alignment
TreeException - Thrown if the constrainer has a problem with the tree

getAlignment

public Alignment getAlignment(int length,
                              java.util.Map<java.lang.String,java.lang.String> recode)
                       throws AlignmentException,
                              TreeException
Gets a simulated alignment, not returing the state of internal nodes. Recodes the simulated data before returning. For example if both "A" and "B" are unobserved states representing an observed state of "0" then this can be used to change "A" and "B" to zero. This is neccessay as the simulator generates unobserved states by default. The returned site will have ambiguous data set as appropiate.

Parameters:
length - The length of the alignment
recode - Map of recodings
Returns:
The simulated alignment
Throws:
AlignmentException - Thrown if there is a problem with the alignment
TreeException - Thrown if the constrainer has a problem with the tree

getAlignment

public Alignment getAlignment(int length,
                              boolean internal,
                              java.util.Map<java.lang.String,java.lang.String> recode)
                       throws AlignmentException,
                              TreeException
Gets a simulated alignment. Recodes the simulated data before returning. For example if both "A" and "B" are unobserved states representing an observed state of "0" then this can be used to change "A" and "B" to zero. This is neccessay as the simulator generates unobserved states by default. The returned site will have ambiguous data set as appropiate.

Parameters:
length - The length of the alignment
internal - Whether to return the state of the internal nodes
recode - Map of recodings
Returns:
The simulated alignment
Throws:
AlignmentException - Thrown if there is a problem with the alignment
TreeException - Thrown if the constrainer has a problem with the tree