treetime/nuc_models.py
def F81(mu=1.0, pi=None, alphabet="nuc", **kwargs):
    """
    Felsenstein 1981 model. Assumes non-equal concentrations across nucleotides,
    but the transition rate between all states is assumed to be equal. See
    Felsenstein (1981), J. Mol. Evol. 17  (6): 368–376. doi:10.1007/BF01734359
    for details.

    Current implementation of the model does not account for the gaps (treatment of
    gaps as characters is possible if specify alphabet='nuc_gap').

    Parameters
    -----------


     mu : float
        Substitution rate

     pi : numpy.array
        Nucleotide concentrations

     alphabet : str
        Alphabet to use. POsiible values are: ['nuc', 'nuc_gap'] Default 'nuc', which discounts al gaps.
        'nuc_gap' alphabet enables treatmen of gaps as characters.
    """

    if pi is None:
        pi=0.25*np.ones(4, dtype=float)
    num_chars = len(alphabets[alphabet])

    pi = np.array(pi, dtype=float)

    if num_chars != len(pi) :
        pi = np.ones((num_chars, ), dtype=float)
        print ("GTR: Warning!The number of the characters in the alphabet does not match the "
            "shape of the vector of equilibrium frequencies Pi -- assuming equal frequencies for all states.")

    W = np.ones((num_chars,num_chars))
    pi /= (1.0 * np.sum(pi))
    gtr = GTR(alphabet=alphabets[alphabet])
    gtr.assign_rates(mu=mu, pi=pi, W=W)
    return gtr
def F81(mu=1.0, pi=None, alphabet="nuc", **kwargs):
    """
    Felsenstein 1981 model. Assumes non-equal concentrations across nucleotides,
    but the transition rate between all states is assumed to be equal. See
    Felsenstein (1981), J. Mol. Evol. 17  (6): 368–376. doi:10.1007/BF01734359
    for details.

    Current implementation of the model does not account for the gaps (treatment of
    gaps as characters is possible if specify alphabet='nuc_gap').

    Parameters
    -----------


     mu : float
        Substitution rate

     pi : numpy.array
        Nucleotide concentrations

     alphabet : str
        Alphabet to use. POsiible values are: ['nuc', 'nuc_gap'] Default 'nuc', which discounts al gaps.
        'nuc_gap' alphabet enables treatmen of gaps as characters.
    """

    if pi is None:
        pi=0.25*np.ones(4, dtype=float)
    num_chars = len(alphabets[alphabet])

    pi = np.array(pi, dtype=float)

    if num_chars != len(pi) :
        pi = np.ones((num_chars, ), dtype=float)
        print ("GTR: Warning!The number of the characters in the alphabet does not match the "
            "shape of the vector of equilibrium frequencies Pi -- assuming equal frequencies for all states.")

    W = np.ones((num_chars,num_chars))
    pi /= (1.0 * np.sum(pi))
    gtr = GTR(alphabet=alphabets[alphabet])
    gtr.assign_rates(mu=mu, pi=pi, W=W)
    return gtr
def F81 ( mu = 1.0 , pi = None , alphabet = "nuc" , * * kwargs ) : if pi is None : pi = 0.25 * np . ones ( 4 , dtype = float ) num_chars = len ( alphabets [ alphabet ] ) pi = np . array ( pi , dtype = float ) if num_chars != len ( pi ) : pi = np . ones ( ( num_chars , ) , dtype = float ) print ( "GTR: Warning!The number of the characters in the alphabet does not match the " "shape of the vector of equilibrium frequencies Pi -- assuming equal frequencies for all states." ) W = np . ones ( ( num_chars , num_chars ) ) pi /= ( 1.0 * np . sum ( pi ) ) gtr = GTR ( alphabet = alphabets [ alphabet ] ) gtr . assign_rates ( mu = mu , pi = pi , W = W ) return gtr
Felsenstein 1981 model. Assumes non-equal concentrations across nucleotides,
    but the transition rate between all states is assumed to be equal. See
    Felsenstein (1981), J. Mol. Evol. 17  (6): 368–376. doi:10.1007/BF01734359
    for details.

    Current implementation of the model does not account for the gaps (treatment of
    gaps as characters is possible if specify alphabet='nuc_gap').

    Parameters
    -----------


     mu : float
        Substitution rate

     pi : numpy.array
        Nucleotide concentrations

     alphabet : str
        Alphabet to use. POsiible values are: ['nuc', 'nuc_gap'] Default 'nuc', which discounts al gaps.
        'nuc_gap' alphabet enables treatmen of gaps as characters.
Felsenstein 1981 model . Assumes non - equal concentrations across nucleotides but the transition rate between all states is assumed to be equal . See Felsenstein ( 1981 ) J . Mol . Evol . 17 ( 6 ) : 368–376 . doi : 10 . 1007 / BF01734359 for details .