This function calculates average behavior of each codon for all pairwise comparisons for indels, syn, and nonsyn mutations according to Nei and Gojobori (1986).

codonmat2xy(codonmat, threads = 1)

Arguments

codonmat

codon matrix obtained via dnastring2codonmat [mandatory]

threads

number of parallel threads [default: 1]

Value

A data.frame object with the following components:

Codon Codon index

n number of comparison

SynSum Sum of syn

NonSynSum Sum of nonsyn

IndelSum Sum of indels

SynMean average syn per codon

NonSynMean average nonsyn per codon

IndelMean average indels per codon

CumSumSynMean cumulative average syn per codon

CumSumNonSynMean cumulative average nonsyn per codon

CumSumIndelMean cumulative indels per codon

References

Nei and Gojobori. (1986) Simple methods for estimating the numbers of synonymous and nonsynonymous nucleotide substitutions. Mol. Biol. Evol., 3(5), 418-426.

Ganeshan et al. (1997) Human immunodeficiency virus type 1 genetic evolution in children with different rates of development of disease. J. Virology. 71(1), 663-677.

Yang et al. (2000) Codon-substitution models for heterogeneous selection pressure at amino acid sites. Genetics. 155(1), 431-449.

Author

Kristian K Ullrich

Examples

## load example sequence data
data("hiv", package="MSA2dist")
#codonmat2xy(dnastring2codonmat(hiv))
hiv |> dnastring2codonmat() |> codonmat2xy()
#> Joining, by = "Codon"
#> Joining, by = "Codon"
#> Joining, by = "Codon"
#> # A tibble: 91 × 11
#> # Groups:   Codon [91]
#>    Codon     n SynSum NonSynSum IndelSum SynMean NonSy…¹ Indel…² CumSu…³ CumSu…⁴
#>    <dbl> <int>  <dbl>     <dbl>    <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
#>  1     1    78      0        40        0   0       0.513       0   0       0.513
#>  2     2    78      0         0        0   0       0           0   0       0.513
#>  3     3    78     12         0        0   0.154   0           0   0.154   0.513
#>  4     4    78     12         0        0   0.154   0           0   0.308   0.513
#>  5     5    78      0         0        0   0       0           0   0.308   0.513
#>  6     6    78      0         0        0   0       0           0   0.308   0.513
#>  7     7    78      0         0        0   0       0           0   0.308   0.513
#>  8     8    78      0         0        0   0       0           0   0.308   0.513
#>  9     9    78     22        30        0   0.282   0.385       0   0.590   0.897
#> 10    10    78      0        40        0   0       0.513       0   0.590   1.41 
#> # … with 81 more rows, 1 more variable: CumSumIndelMean <dbl>, and abbreviated
#> #   variable names ¹​NonSynMean, ²​IndelMean, ³​CumSumSynMean, ⁴​CumSumNonSynMean
#codonmat2xy(dnastring2codonmat(hiv), threads=2)
hiv |> dnastring2codonmat() |> codonmat2xy(threads=2)
#> Joining, by = "Codon"
#> Joining, by = "Codon"
#> Joining, by = "Codon"
#> # A tibble: 91 × 11
#> # Groups:   Codon [91]
#>    Codon     n SynSum NonSynSum IndelSum SynMean NonSy…¹ Indel…² CumSu…³ CumSu…⁴
#>    <dbl> <int>  <dbl>     <dbl>    <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
#>  1     1    78      0        40        0   0       0.513       0   0       0.513
#>  2     2    78      0         0        0   0       0           0   0       0.513
#>  3     3    78     12         0        0   0.154   0           0   0.154   0.513
#>  4     4    78     12         0        0   0.154   0           0   0.308   0.513
#>  5     5    78      0         0        0   0       0           0   0.308   0.513
#>  6     6    78      0         0        0   0       0           0   0.308   0.513
#>  7     7    78      0         0        0   0       0           0   0.308   0.513
#>  8     8    78      0         0        0   0       0           0   0.308   0.513
#>  9     9    78     22        30        0   0.282   0.385       0   0.590   0.897
#> 10    10    78      0        40        0   0       0.513       0   0.590   1.41 
#> # … with 81 more rows, 1 more variable: CumSumIndelMean <dbl>, and abbreviated
#> #   variable names ¹​NonSynMean, ²​IndelMean, ³​CumSumSynMean, ⁴​CumSumNonSynMean