R/params_setting.R
generate_K2P_matrix.RdGenerate a Kimura 2-Parameter (K2P) Transition Matrix
This function generates a 5x5 transition probability matrix based on the Kimura 2-Parameter (K2P) model.
The matrix includes transition rates for nucleotides (A, C, G, T) and an additional state (N),
where transitions and transversions are governed by the parameters alpha and beta.
generate_K2P_matrix(alpha, beta)A 5x5 matrix with row and column names (A, C, G, T, N) containing substitution probabilities. The matrix entries represent the probability of transitioning from the row nucleotide to the column nucleotide.
The K2P model assumes:
Different rates for transitions (alpha) and transversions (beta)
Equal base frequencies
The 'N' state can only transition to itself
No transitions are allowed between any nucleotide and 'N'
Matrix entries are normalized by (2*beta + alpha) to ensure proper probability distribution.
# Generate K2P matrix with transition rate 0.3 and transversion rate 0.1
K2P <- generate_K2P_matrix(alpha = 0.3, beta = 0.1)
#> Warning: restarting interrupted promise evaluation
#> Warning: internal error -3 in R_decompress1
#> Error: lazy-load database '/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/cancerSimCraft/R/cancerSimCraft.rdb' is corrupt