R/convertQiimeOTUtab.R

#   This is a function to transform the Qiime OTU table
#
#   Qiime OTU table:
#   OTU ID  Sample1   Sample2   .....   taxonomy
#   1       0         3                 k__xxxx; p__xxx;
#   2       0         2
#   3       0         3
#
#   To:
#
#   taxonomy  Sample1 Sample2
#   xxx.xxx   0       3
#   xxx.xxx   0       2
#   xxx.xxx   0       3

category <- c("k", "p", "c", "o", "f", "g", "s")

extractTaxTab <- function(df, cName = "taxonomy"){
  df <- as.data.frame(df)
  res <- df$cName
  res
}
raytonghk/urPac documentation built on May 8, 2019, 11:47 a.m.