Creating naming schemes consistency and deprecating the load_* functions.
From: Joseph N. Paulson <jpaulson@jimmy.harvard.edu>
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/metagenomeSeq@121795 bc3139a8-67e5-0310-9ffc-ced21a209358
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,28 @@ |
1 |
+#' Load a count dataset associated with a study set up in a Qiime format. |
|
2 |
+#' |
|
3 |
+#' Load a matrix of OTUs in Qiime's format |
|
4 |
+#' |
|
5 |
+#' |
|
6 |
+#' @aliases loadMetaQ qiimeLoader |
|
7 |
+#' @param file Path and filename of the actual data file. |
|
8 |
+#' @return An list with 'counts' containing the count data, 'taxa' containing the otu annotation, and 'otus'. |
|
9 |
+#' @seealso \code{\link{loadMeta}} \code{\link{loadPhenoData}} |
|
10 |
+#' @examples |
|
11 |
+#' |
|
12 |
+#' # see vignette |
|
13 |
+#' |
|
14 |
+loadMetaQ <- function(file) { |
|
15 |
+ dat2 <- read.delim(file,header=FALSE,stringsAsFactors=FALSE,nrows=1,skip=1); |
|
16 |
+ len = ncol(dat2) |
|
17 |
+ subjects = as.character(dat2[1,-c(1,len)]); |
|
18 |
+ classes <-c("character",rep("numeric",(len-2)),"character"); |
|
19 |
+ dat3 <- read.delim(file,header=TRUE,colClasses=classes,skip=1); |
|
20 |
+ taxa<- dat3[,len]; |
|
21 |
+ taxa<-as.matrix(taxa); |
|
22 |
+ matrix <- dat3[,-c(1,len)] |
|
23 |
+ colnames(matrix) = subjects; |
|
24 |
+ otus = dat3[,1]; |
|
25 |
+ rownames(matrix) = otus; |
|
26 |
+ obj <- list(counts=as.data.frame(matrix), taxa=as.data.frame(taxa),otus = as.data.frame(otus)) |
|
27 |
+ return(obj); |
|
28 |
+} |