Models and modeling of discrete character evolution.
Base class for discrete character substitution models.
__init__ initializes the state_alphabet to define the character type on which this model acts. The objects random number generator will be rng or ‘GLOBAL_RNG’
Evolves sequences on a tree.
__init__ sets up metadata dealing with object nomenclature and semantics.
Appends a new sequence of length seq_len to a list at each node in tree. The attribute name of this list in each node is given by seq_attr. If seq_model is None, tree.seq_model or seq_model at each node must be specified. If in_place is False, the tree is copied first, otherwise original tree is modified. If root_states is given, this will be used as the sequence for the root. If not, and if simulate_root_states is True, then the sequence for the root will be drawn from the stationary distribution of the character model.
Creates a character matrix with new sequences (or extends sequences of an existing character matrix if provided via char_matrix), where the the sequence for each taxon corresponds to the concatenation of all sequences in the list of sequences associated with tip that references the given taxon. Specific sequences to be included/excluded can be finetuned using the include and exclude args, where include=None means to include all by default, and exclude=None means to exclude all by default.
Hasegawa et al. 1985 model. Implementation following Swofford et al., 1996.
__init__: if no arguments given, defaults to JC69.
Returns the factor that we have to multiply to the branch length to make branch lengths proportional to # of substitutions per site.
Returns probability, p_ij, of going from state i to state j over time tlen at given rate. (tlen * rate = nu, expected number of substitutions)
Returns a matrix of nucleotide substitution probabilities. Based on analytical solution by Swofford et al., 1996. (tlen * rate = nu, expected number of substitutions)
JukesCantor 1969 model. Specializes HKY85 such that kappa = 1.0, and base frequencies = [0.25, 0.25, 0.25, 0.25].
__init__: uses Hky85.__init__
General nucleotide substitution model.
__init__ calls SeqModel.__init__ and sets the base_freqs field
Returns True if state_index represents a purine (A or G) row or column index: 0, 2
Returns True if the change from state1 to state2, as represented by the row or column indices, is a purine transitional change.
Returns True if state_index represents a pyrimidine (C or T) row or column index: 1, 3
Returns True if the change from state1 to state2, as represented by the row or column indices, is a pyrimidine transitional change.
Returns True if the change from state1 to state2, as represented by the row or column indices, is a transitional change.
Convenience class to wrap generation of characters (as a CharacterBlock object) based on the HKY model.
Parameters: 


Returns: 

Wrapper to conveniently generate a DataSet simulated under the given tree and character model.
Parameters: 


Returns:  d (DataSet) 
Wrapper to conveniently generate a characters simulated under the given tree and character model.
Since characters will be appended to existing sequences, you can simulate a sequences under a mixed model by calling this method multiple times with different character models and/or different mutation rates, passing in the same char_matrix object each time.
Parameters: 


Returns:  d (a dendropy.datamodel.CharacterMatrix object.) 