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
... | ... |
@@ -2,6 +2,7 @@ version 1.15.xx (2016) |
2 | 2 |
+ Added 'mergeMRexperiment' function |
3 | 3 |
+ Replaced RUnit with testthat library for unit testing |
4 | 4 |
+ Adding multiple upgrades and changes throughout |
5 |
+ + Deprecated the load_* functions and created load* function. |
|
5 | 6 |
version 1.13.xx (2015) |
6 | 7 |
+ Upgrade support for biom-format vs. 2.0 |
7 | 8 |
+ Fixed issue - "MRtable, etc will report NA rows when user requests more features than available" |
... | ... |
@@ -9,7 +9,7 @@ |
9 | 9 |
#' @param sl scaling factor for normalized counts. |
10 | 10 |
#' @param qiimeVersion Format fData according to QIIME specifications (assumes only taxonomy in fData). |
11 | 11 |
#' @return A biom object. |
12 |
-#' @seealso \code{\link{load_meta}} \code{\link{load_phenoData}} \code{\link{newMRexperiment}} \code{\link{load_biom}} \code{\link{biom2MRexperiment}} |
|
12 |
+#' @seealso \code{\link{loadMeta}} \code{\link{loadPhenoData}} \code{\link{newMRexperiment}} \code{\link{loadBiom}} \code{\link{biom2MRexperiment}} |
|
13 | 13 |
MRexperiment2biom <- function(obj,id=NULL,norm=FALSE,log=FALSE,sl=1000,qiimeVersion=TRUE){ |
14 | 14 |
requireNamespace("biomformat") |
15 | 15 |
id = id |
... | ... |
@@ -4,7 +4,7 @@ |
4 | 4 |
#' |
5 | 5 |
#' @param obj The biom object file. |
6 | 6 |
#' @return A MRexperiment object. |
7 |
-#' @seealso \code{\link{load_meta}} \code{\link{load_phenoData}} \code{\link{newMRexperiment}} \code{\link{load_biom}} |
|
7 |
+#' @seealso \code{\link{loadMeta}} \code{\link{loadPhenoData}} \code{\link{newMRexperiment}} \code{\link{loadBiom}} |
|
8 | 8 |
#' @examples |
9 | 9 |
#' |
10 | 10 |
#' #library(biomformat) |
... | ... |
@@ -13,7 +13,11 @@ |
13 | 13 |
#' parameters to be passed to the modern version of the function (see table). |
14 | 14 |
#' @docType package |
15 | 15 |
#' @export fitMeta |
16 |
-#' @aliases deprecated_metagenomeSeq_function fitMeta |
|
16 |
+#' @aliases deprecated_metagenomeSeq_function fitMeta load_phenoData load_meta load_biom load_metaQ |
|
17 | 17 |
#' |
18 | 18 |
deprecated_metagenomeSeq_function <- function(x, value, ...){return(NULL)} |
19 | 19 |
fitMeta <- function(...){.Deprecated("fitMeta",package="metagenomeSeq");return(fitLogNormal(...))} |
20 |
+load_phenoData <- function(...){.Deprecated("load_phenoData",package="metagenomeSeq");return(loadPhenodata(...))} |
|
21 |
+load_biom <- function(...){.Deprecated("load_biom",package="metagenomeSeq");return(loadBiom(...))} |
|
22 |
+load_meta <- function(...){.Deprecated("load_meta",package="metagenomeSeq");return(loadMeta(...))} |
|
23 |
+load_metaQ <- function(...){.Deprecated("load_metaQ",package="metagenomeSeq");return(loadMetaQ(...))} |
20 | 24 |
similarity index 69% |
21 | 25 |
rename from R/load_biom.R |
22 | 26 |
rename to R/loadBiom.R |
... | ... |
@@ -4,14 +4,14 @@ |
4 | 4 |
#' |
5 | 5 |
#' @param file The biom object filepath. |
6 | 6 |
#' @return A MRexperiment object. |
7 |
-#' @seealso \code{\link{load_meta}} \code{\link{load_phenoData}} \code{\link{newMRexperiment}} \code{\link{biom2MRexperiment}} |
|
7 |
+#' @seealso \code{\link{loadMeta}} \code{\link{loadPhenoData}} \code{\link{newMRexperiment}} \code{\link{biom2MRexperiment}} |
|
8 | 8 |
#' @examples |
9 | 9 |
#' |
10 | 10 |
#' #library(biomformat) |
11 | 11 |
#' #rich_dense_file = system.file("extdata", "rich_dense_otu_table.biom", package = "biomformat") |
12 |
-#' #x = load_biom(rich_dense_file) |
|
12 |
+#' #x = loadBiom(rich_dense_file) |
|
13 | 13 |
#' #x |
14 |
-load_biom <- function(file){ |
|
14 |
+loadBiom <- function(file){ |
|
15 | 15 |
requireNamespace("biomformat") |
16 | 16 |
x = biomformat::read_biom(file); |
17 | 17 |
mrobj = biom2MRexperiment(x); |
18 | 18 |
similarity index 79% |
19 | 19 |
rename from R/load_meta.R |
20 | 20 |
rename to R/loadMeta.R |
... | ... |
@@ -3,17 +3,17 @@ |
3 | 3 |
#' Load a matrix of OTUs in a tab delimited format |
4 | 4 |
#' |
5 | 5 |
#' |
6 |
-#' @aliases load_meta metagenomicLoader |
|
6 |
+#' @aliases loadMeta metagenomicLoader |
|
7 | 7 |
#' @param file Path and filename of the actual data file. |
8 | 8 |
#' @param sep File delimiter. |
9 | 9 |
#' @return A list with objects 'counts' and 'taxa'. |
10 |
-#' @seealso \code{\link{load_phenoData}} |
|
10 |
+#' @seealso \code{\link{loadPhenoData}} |
|
11 | 11 |
#' @examples |
12 | 12 |
#' |
13 | 13 |
#' dataDirectory <- system.file("extdata", package="metagenomeSeq") |
14 |
-#' lung = load_meta(file.path(dataDirectory,"CHK_NAME.otus.count.csv")) |
|
14 |
+#' lung = loadMeta(file.path(dataDirectory,"CHK_NAME.otus.count.csv")) |
|
15 | 15 |
#' |
16 |
-load_meta <- function(file,sep="\t") |
|
16 |
+loadMeta <- function(file,sep="\t") |
|
17 | 17 |
{ |
18 | 18 |
dat2 <- read.table(file,header=FALSE,sep=sep,nrows=1,stringsAsFactors=FALSE); |
19 | 19 |
subjects <- as.character(dat2[1,-1]); |
20 | 20 |
similarity index 86% |
21 | 21 |
rename from R/load_metaQ.R |
22 | 22 |
rename to R/loadMetaQ.R |
... | ... |
@@ -3,15 +3,15 @@ |
3 | 3 |
#' Load a matrix of OTUs in Qiime's format |
4 | 4 |
#' |
5 | 5 |
#' |
6 |
-#' @aliases load_metaQ qiimeLoader |
|
6 |
+#' @aliases loadMetaQ qiimeLoader |
|
7 | 7 |
#' @param file Path and filename of the actual data file. |
8 | 8 |
#' @return An list with 'counts' containing the count data, 'taxa' containing the otu annotation, and 'otus'. |
9 |
-#' @seealso \code{\link{load_meta}} \code{\link{load_phenoData}} |
|
9 |
+#' @seealso \code{\link{loadMeta}} \code{\link{loadPhenoData}} |
|
10 | 10 |
#' @examples |
11 | 11 |
#' |
12 | 12 |
#' # see vignette |
13 | 13 |
#' |
14 |
-load_metaQ <- function(file) { |
|
14 |
+loadMetaQ <- function(file) { |
|
15 | 15 |
dat2 <- read.delim(file,header=FALSE,stringsAsFactors=FALSE,nrows=1,skip=1); |
16 | 16 |
len = ncol(dat2) |
17 | 17 |
subjects = as.character(dat2[1,-c(1,len)]); |
18 | 18 |
similarity index 90% |
19 | 19 |
rename from R/load_phenoData.R |
20 | 20 |
rename to R/loadPhenoData.R |
... | ... |
@@ -3,18 +3,18 @@ |
3 | 3 |
#' Load a matrix of metadata associated with a study. |
4 | 4 |
#' |
5 | 5 |
#' |
6 |
-#' @aliases load_phenoData phenoData |
|
6 |
+#' @aliases loadPhenoData phenoData |
|
7 | 7 |
#' @param file Path and filename of the actual clinical file. |
8 | 8 |
#' @param tran Boolean. If the covariates are along the columns and samples |
9 | 9 |
#' along the rows, then tran should equal TRUE. |
10 | 10 |
#' @param sep The separator for the file. |
11 | 11 |
#' @return The metadata as a dataframe. |
12 |
-#' @seealso \code{\link{load_meta}} |
|
12 |
+#' @seealso \code{\link{loadMeta}} |
|
13 | 13 |
#' @examples |
14 | 14 |
#' |
15 | 15 |
#' # see vignette |
16 | 16 |
#' |
17 |
-load_phenoData <-function(file,tran=TRUE,sep="\t") |
|
17 |
+loadPhenoData <-function(file,tran=TRUE,sep="\t") |
|
18 | 18 |
{ |
19 | 19 |
dat2 <- read.table(file,header=FALSE,sep=sep); |
20 | 20 |
|
... | ... |
@@ -27,6 +27,6 @@ A biom object. |
27 | 27 |
Wrapper to convert MRexperiment objects to biom objects. |
28 | 28 |
} |
29 | 29 |
\seealso{ |
30 |
-\code{\link{load_meta}} \code{\link{load_phenoData}} \code{\link{newMRexperiment}} \code{\link{load_biom}} \code{\link{biom2MRexperiment}} |
|
30 |
+\code{\link{loadMeta}} \code{\link{loadPhenoData}} \code{\link{newMRexperiment}} \code{\link{loadBiom}} \code{\link{biom2MRexperiment}} |
|
31 | 31 |
} |
32 | 32 |
|
... | ... |
@@ -23,6 +23,6 @@ Wrapper to convert biom files to MRexperiment objects. |
23 | 23 |
#biom2MRexperiment(x) |
24 | 24 |
} |
25 | 25 |
\seealso{ |
26 |
-\code{\link{load_meta}} \code{\link{load_phenoData}} \code{\link{newMRexperiment}} \code{\link{load_biom}} |
|
26 |
+\code{\link{loadMeta}} \code{\link{loadPhenoData}} \code{\link{newMRexperiment}} \code{\link{loadBiom}} |
|
27 | 27 |
} |
28 | 28 |
|
29 | 29 |
similarity index 61% |
30 | 30 |
rename from man/load_biom.Rd |
31 | 31 |
rename to man/loadBiom.Rd |
... | ... |
@@ -1,10 +1,10 @@ |
1 | 1 |
% Generated by roxygen2: do not edit by hand |
2 |
-% Please edit documentation in R/load_biom.R |
|
3 |
-\name{load_biom} |
|
4 |
-\alias{load_biom} |
|
2 |
+% Please edit documentation in R/loadBiom.R |
|
3 |
+\name{loadBiom} |
|
4 |
+\alias{loadBiom} |
|
5 | 5 |
\title{Load objects organized in the Biom format.} |
6 | 6 |
\usage{ |
7 |
-load_biom(file) |
|
7 |
+loadBiom(file) |
|
8 | 8 |
} |
9 | 9 |
\arguments{ |
10 | 10 |
\item{file}{The biom object filepath.} |
... | ... |
@@ -19,10 +19,10 @@ Wrapper to load Biom formatted object. |
19 | 19 |
|
20 | 20 |
#library(biomformat) |
21 | 21 |
#rich_dense_file = system.file("extdata", "rich_dense_otu_table.biom", package = "biomformat") |
22 |
-#x = load_biom(rich_dense_file) |
|
22 |
+#x = loadBiom(rich_dense_file) |
|
23 | 23 |
#x |
24 | 24 |
} |
25 | 25 |
\seealso{ |
26 |
-\code{\link{load_meta}} \code{\link{load_phenoData}} \code{\link{newMRexperiment}} \code{\link{biom2MRexperiment}} |
|
26 |
+\code{\link{loadMeta}} \code{\link{loadPhenoData}} \code{\link{newMRexperiment}} \code{\link{biom2MRexperiment}} |
|
27 | 27 |
} |
28 | 28 |
|
29 | 29 |
similarity index 68% |
30 | 30 |
rename from man/load_meta.Rd |
31 | 31 |
rename to man/loadMeta.Rd |
... | ... |
@@ -1,11 +1,11 @@ |
1 | 1 |
% Generated by roxygen2: do not edit by hand |
2 |
-% Please edit documentation in R/load_meta.R |
|
3 |
-\name{load_meta} |
|
4 |
-\alias{load_meta} |
|
2 |
+% Please edit documentation in R/loadMeta.R |
|
3 |
+\name{loadMeta} |
|
4 |
+\alias{loadMeta} |
|
5 | 5 |
\alias{metagenomicLoader} |
6 | 6 |
\title{Load a count dataset associated with a study.} |
7 | 7 |
\usage{ |
8 |
-load_meta(file, sep = "\\t") |
|
8 |
+loadMeta(file, sep = "\\t") |
|
9 | 9 |
} |
10 | 10 |
\arguments{ |
11 | 11 |
\item{file}{Path and filename of the actual data file.} |
... | ... |
@@ -21,10 +21,10 @@ Load a matrix of OTUs in a tab delimited format |
21 | 21 |
\examples{ |
22 | 22 |
|
23 | 23 |
dataDirectory <- system.file("extdata", package="metagenomeSeq") |
24 |
-lung = load_meta(file.path(dataDirectory,"CHK_NAME.otus.count.csv")) |
|
24 |
+lung = loadMeta(file.path(dataDirectory,"CHK_NAME.otus.count.csv")) |
|
25 | 25 |
|
26 | 26 |
} |
27 | 27 |
\seealso{ |
28 |
-\code{\link{load_phenoData}} |
|
28 |
+\code{\link{loadPhenoData}} |
|
29 | 29 |
} |
30 | 30 |
|
31 | 31 |
similarity index 73% |
32 | 32 |
rename from man/load_metaQ.Rd |
33 | 33 |
rename to man/loadMetaQ.Rd |
... | ... |
@@ -1,11 +1,11 @@ |
1 | 1 |
% Generated by roxygen2: do not edit by hand |
2 |
-% Please edit documentation in R/load_metaQ.R |
|
3 |
-\name{load_metaQ} |
|
4 |
-\alias{load_metaQ} |
|
2 |
+% Please edit documentation in R/loadMetaQ.R |
|
3 |
+\name{loadMetaQ} |
|
4 |
+\alias{loadMetaQ} |
|
5 | 5 |
\alias{qiimeLoader} |
6 | 6 |
\title{Load a count dataset associated with a study set up in a Qiime format.} |
7 | 7 |
\usage{ |
8 |
-load_metaQ(file) |
|
8 |
+loadMetaQ(file) |
|
9 | 9 |
} |
10 | 10 |
\arguments{ |
11 | 11 |
\item{file}{Path and filename of the actual data file.} |
... | ... |
@@ -22,6 +22,6 @@ Load a matrix of OTUs in Qiime's format |
22 | 22 |
|
23 | 23 |
} |
24 | 24 |
\seealso{ |
25 |
-\code{\link{load_meta}} \code{\link{load_phenoData}} |
|
25 |
+\code{\link{loadMeta}} \code{\link{loadPhenoData}} |
|
26 | 26 |
} |
27 | 27 |
|
28 | 28 |
similarity index 75% |
29 | 29 |
rename from man/load_phenoData.Rd |
30 | 30 |
rename to man/loadPhenoData.Rd |
... | ... |
@@ -1,11 +1,11 @@ |
1 | 1 |
% Generated by roxygen2: do not edit by hand |
2 |
-% Please edit documentation in R/load_phenoData.R |
|
3 |
-\name{load_phenoData} |
|
4 |
-\alias{load_phenoData} |
|
2 |
+% Please edit documentation in R/loadPhenoData.R |
|
3 |
+\name{loadPhenoData} |
|
4 |
+\alias{loadPhenoData} |
|
5 | 5 |
\alias{phenoData} |
6 | 6 |
\title{Load a clinical/phenotypic dataset associated with a study.} |
7 | 7 |
\usage{ |
8 |
-load_phenoData(file, tran = TRUE, sep = "\\t") |
|
8 |
+loadPhenoData(file, tran = TRUE, sep = "\\t") |
|
9 | 9 |
} |
10 | 10 |
\arguments{ |
11 | 11 |
\item{file}{Path and filename of the actual clinical file.} |
... | ... |
@@ -27,6 +27,6 @@ Load a matrix of metadata associated with a study. |
27 | 27 |
|
28 | 28 |
} |
29 | 29 |
\seealso{ |
30 |
-\code{\link{load_meta}} |
|
30 |
+\code{\link{loadMeta}} |
|
31 | 31 |
} |
32 | 32 |
|
... | ... |
@@ -4,6 +4,10 @@ |
4 | 4 |
\name{metagenomeSeq-deprecated} |
5 | 5 |
\alias{deprecated_metagenomeSeq_function} |
6 | 6 |
\alias{fitMeta} |
7 |
+\alias{load_biom} |
|
8 |
+\alias{load_meta} |
|
9 |
+\alias{load_metaQ} |
|
10 |
+\alias{load_phenoData} |
|
7 | 11 |
\alias{metagenomeSeq-deprecated} |
8 | 12 |
\alias{metagenomeSeq-deprecated-package} |
9 | 13 |
\title{Depcrecated functions in the metagenomeSeq package.} |
... | ... |
@@ -82,22 +82,22 @@ Data is prepared and formatted as a \texttt{MRexperiment} object. For an overvie |
82 | 82 |
|
83 | 83 |
|
84 | 84 |
\subsection{Biom-Format} |
85 |
-You can load in BIOM file format data, the output of many popular tools out there, using the \texttt{load$\_$biom} function. |
|
85 |
+You can load in BIOM file format data, the output of many popular tools out there, using the \texttt{loadBiom} function. |
|
86 | 86 |
Tthe \texttt{biom2MRexperiment} and \texttt{MRexperiment2biom} functions serve as a gateway between the \texttt{biom-class} object defined in the \textbf{biom} package and a \texttt{MRexperiment-class} object. |
87 | 87 |
|
88 | 88 |
\subsection{Loading count data} |
89 | 89 |
Following preprocessing and annotation of sequencing data \texttt{metagenomeSeq} requires a count matrix with features along rows and samples along the columns. |
90 | 90 |
\texttt{metagenomeSeq} includes functions for loading delimited files of counts |
91 |
-\texttt{load$\_$meta} and phenodata \texttt{load$\_$phenoData}. |
|
91 |
+\texttt{loadMeta} and phenodata \texttt{loadPhenoData}. |
|
92 | 92 |
|
93 | 93 |
As an example, a portion of the lung microbiome \cite{charlson} |
94 | 94 |
OTU matrix is provided in \texttt{metagenomeSeq}'s library "extdata" folder. |
95 | 95 |
The OTU matrix is stored as a tab delimited file. |
96 |
-\texttt{load\_meta} loads the taxa and counts into a list. |
|
96 |
+\texttt{loadMeta} loads the taxa and counts into a list. |
|
97 | 97 |
|
98 | 98 |
<<loadData>>= |
99 | 99 |
dataDirectory <- system.file("extdata", package="metagenomeSeq") |
100 |
-lung = load_meta(file.path(dataDirectory,"CHK_NAME.otus.count.csv")) |
|
100 |
+lung = loadMeta(file.path(dataDirectory,"CHK_NAME.otus.count.csv")) |
|
101 | 101 |
dim(lung$counts) |
102 | 102 |
@ |
103 | 103 |
|
... | ... |
@@ -114,10 +114,10 @@ As our OTUs appear to be in order with the count matrix we loaded earlier, the n |
114 | 114 |
\textbf{Warning}: features need to have the same names as the rows of the count matrix when we create the MRexperiment object for provenance purposes. |
115 | 115 |
|
116 | 116 |
\subsection{Loading metadata} |
117 |
-Phenotype data can be optionally loaded into \texttt{R} with \texttt{load\_phenoData}. This function loads the data as a list. |
|
117 |
+Phenotype data can be optionally loaded into \texttt{R} with \texttt{loadPhenoData}. This function loads the data as a list. |
|
118 | 118 |
|
119 | 119 |
<<loadClin>>= |
120 |
-clin = load_phenoData(file.path(dataDirectory,"CHK_clinical.csv"),tran=TRUE) |
|
120 |
+clin = loadPhenoData(file.path(dataDirectory,"CHK_clinical.csv"),tran=TRUE) |
|
121 | 121 |
ord = match(colnames(lung$counts),rownames(clin)) |
122 | 122 |
clin = clin[ord,] |
123 | 123 |
head(clin[1:2,]) |