R/loadMetaQ.R
f7060c99
 #' Load a count dataset associated with a study set up in a Qiime format.
1f4053bb
 #' 
f7060c99
 #' Load a matrix of OTUs in Qiime's format
1f4053bb
 #' 
 #' 
552624f1
 #' @aliases loadMetaQ qiimeLoader
f7060c99
 #' @param file Path and filename of the actual data file.
2d031e15
 #' @return An list with 'counts' containing the count data, 'taxa' containing the otu annotation, and 'otus'.
552624f1
 #' @seealso \code{\link{loadMeta}} \code{\link{loadPhenoData}}
f7060c99
 #' @examples
1f4053bb
 #' 
 #' # see vignette
 #' 
552624f1
 loadMetaQ <- function(file) {	
2ad5c182
 	dat2 <- read.delim(file,header=FALSE,stringsAsFactors=FALSE,nrows=1,skip=1);
 	len = ncol(dat2)
 	subjects = as.character(dat2[1,-c(1,len)]);
 	classes <-c("character",rep("numeric",(len-2)),"character");
 	dat3 <- read.delim(file,header=TRUE,colClasses=classes,skip=1);
 	taxa<- dat3[,len];
f7060c99
 	taxa<-as.matrix(taxa);
2ad5c182
 	matrix <- dat3[,-c(1,len)]
 	colnames(matrix) = subjects;
 	otus = dat3[,1];
 	rownames(matrix) = otus;
 	obj <- list(counts=as.data.frame(matrix), taxa=as.data.frame(taxa),otus = as.data.frame(otus))
f7060c99
 	return(obj);
 }