This commit is contained in:
hyginn 2017-10-29 22:19:19 -04:00
parent 553b042f20
commit 373da689df

View File

@ -3,12 +3,13 @@
# Purpose: A Bioinformatics Course: # Purpose: A Bioinformatics Course:
# R code accompanying the RPR-Genetic_code_optimality unit. # R code accompanying the RPR-Genetic_code_optimality unit.
# #
# Version: 1.0 # Version: 1.0.1
# #
# Date: 2017 10 16 # Date: 2017 10 16
# Author: Boris Steipe (boris.steipe@utoronto.ca) # Author: Boris Steipe (boris.steipe@utoronto.ca)
# #
# Versions: # Versions:
# 1.0.1 Fixed two bugs discovered by Suan Chin Yeo.
# 1.0 New material. # 1.0 New material.
# #
# #
@ -119,7 +120,7 @@ swappedGC <- function(GC) {
# amino acids have been swapped. # amino acids have been swapped.
aaOrig <- unique(GC) # the amino acids in the input code aaOrig <- unique(GC) # the amino acids in the input code
aaSwap <- sample(aa, length(aa)) # shuffled aaSwap <- sample(aaOrig, length(aaOrig)) # shuffled
names(aaSwap) <- aaOrig # name them after the original names(aaSwap) <- aaOrig # name them after the original
GC[1:64] <- aaSwap[GC] # replace original with shuffled GC[1:64] <- aaSwap[GC] # replace original with shuffled
@ -291,7 +292,7 @@ hist(valUGC,
# This looks like a normal distribution. Let's assume the effect of mutations # This looks like a normal distribution. Let's assume the effect of mutations
# under the universal genetic code is the mean of this distribution: # under the universal genetic code is the mean of this distribution:
effectUGC <- mean(val) # 178.1 effectUGC <- mean(valUGC) # 178.1
# Now we can look at the effects of alternate genetic codes: # Now we can look at the effects of alternate genetic codes: