Description Usage Arguments Value Author(s) Examples
Looks for AA,GG,CC,TT sets major to 0 (most frequently found basepair), minor to 2 (second most frequently found bp), het to 1 (e.g. AG, AC, AT, ...), anything else to NA
1  | 
x | 
 Vector of values to be converted.  | 
Returns a vector of same length as input with translated values.
Greg Ziegler
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  |   recodeBiallele(c("AA","GG","GG","GG","GG","AA"))
  
  ## The function is currently defined as
function(x){
  x <- as.character(x)
  freqs <- names(sort(table(x[x 
  major <- freqs[1]
  if(length(freqs)>1){
    minor <- freqs[2]
  }else{
    minor <- "np"
  }
  
  x[which(x==major)] <-0
  x[which(x==minor)] <-2
  x[which(x 
  x[which(!(x==1|x==0|x==2))]   <- NA
  #x[which(!(x==2|x==0))]   <- NA
  #x[which(x=="N")] <- NA
  return(x)
}
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.