enc: Effective number of codons

Description Usage Arguments Value Warning References Examples

View source: R/enc.r

Description

This function calculate the effective number of codons (ENC) using Wright's formula.

Usage

1
enc(x, y = 0, spp.list = "n", formula = "w")

Arguments

x

a list of KZsqns objects

y

a number to assign the type of codon table to be used for the translation. 0 = standard codon table, 2 = vertibrate mitchodrial (See dna2aa for additional options). If no number is specified or an option other than those provided above is specified, there will be a warning and the standard codon table will be used

spp.list

an array indicating the the species identity of each KZsqns object in the list x. The default option is to calculate an ENC for each KZsqns object. When spp.list is specified, an ENC is calculated for each unique element of spp.list

formula

a char array to denote the formula for calculating ENC. Options include: 'w': Wright's formula, 'f4-': Fuglsang's Ncf4- formula.

Value

an numeric array of the ENCs

Warning

According to Wright's formula, the ENC is the sum of the heterogeneity of all the degeneracy classes. When all the codons belonging to a degeneracy class is missing, the ENC can not be calculated. A warning will result when it happens. The most likely situation leading to such a condition is that the sequence of codons is too short. When the sequence is short, the calculated ENC is likely to deviate much from the underlying value. It is recommended to increase the sample size to solve this issue when Wright's formula is prefered. Alternatively, Fuglsang's Ncf4- formula could be used instead.

References

Fuglsang, A., 2006 Estimating the "Effective Number of Codons": The Wright way of determining codon homozygosity leads to superior estimates. Genetics 172:1301-1307 Wright, F., 1990 The 'effective number of codons' used in a gene. Gene 87: 23-29.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
dnalist = vector('list', 2)
dnalist[[1]] = CodonTable2[sample(1:64, 1e4, TRUE),1]
attr(dnalist[[1]], 'class') <- 'KZsqns'
dnalist[[2]] = CodonTable2[sample(1:64, 1e4, TRUE),1]
attr(dnalist[[2]], 'class') <- 'KZsqns'
enc(x = dnalist, y = 2) # Two numbers should be around 60 as there are 60 animo acid coding codons and 4 stop codons for codon table 2

dnalist = vector('list', 2)
dnalist[[1]] = CodonTable2[sample(1:64, 1e4, TRUE),1]
attr(dnalist[[1]], 'class') <- 'KZsqns'
dnalist[[2]] = CodonTable2[sample(1:64, 1e4, TRUE),1]
attr(dnalist[[2]], 'class') <- 'KZsqns'
enc(x = dnalist, y = 4) # Two numbers should be around 62 as there are 60 animo acid coding codons and 2 stop codons for codon table 4

HVoltBb/kondonz documentation built on Jan. 11, 2020, 3:30 a.m.