bugfixes
This commit is contained in:
		@@ -3,13 +3,14 @@
 | 
				
			|||||||
# 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    New material.
 | 
					#           1.0.1    Fixed two bugs discovered by Suan Chin Yeo.
 | 
				
			||||||
 | 
					#           1.0      New material.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# TODO:
 | 
					# TODO:
 | 
				
			||||||
@@ -118,10 +119,10 @@ swappedGC <- function(GC) {
 | 
				
			|||||||
  # Value:  named chr  same vector with random amino acid assignments where the
 | 
					  # Value:  named chr  same vector with random amino acid assignments where the
 | 
				
			||||||
  #                       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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return(GC)
 | 
					  return(GC)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -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:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user