Skip to content

Commit

Permalink
Minor changes before CRAN release
Browse files Browse the repository at this point in the history
  • Loading branch information
Marie-Laure DELIGNETTE-MULLER committed Sep 12, 2019
1 parent ec157f3 commit 56fbc0e
Show file tree
Hide file tree
Showing 20 changed files with 84 additions and 68 deletions.
7 changes: 6 additions & 1 deletion R/RNAseqdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ RNAseqdata <- function(file, check = TRUE,
subdata4check <- data[1:min(nrow(data), 10), ]
subdata4checkT <- trunc(subdata4check)
if (!identical(subdata4check, subdata4checkT))
warning("Your data contain non integer values.
stop("Your data contain non integer values.
Make sure that your RNAseq data are imported in raw counts.\n")
if (nrowd < 100)
warning("Your dataset contains less than 100 lines. Are you sure you really
work on RNAseq data ? This function should
not be used with another type of data.")


if (check)
{
Expand Down
4 changes: 4 additions & 0 deletions R/metabolomicdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ metabolomicdata <- function(file, check = TRUE)
if (any(data > 100))
warning("Your data contain high values (> 100).
Make sure that your data (metabolomic signal) are in log-scale.\n")
if (nrowd < 100)
warning("Your dataset contains less than 100 lines. Are you sure you really
work on metabolomics data ? This function should
not be used with another type of data.")

if (check)
{
Expand Down
4 changes: 4 additions & 0 deletions R/microarraydata.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ microarraydata <- function(file, check = TRUE,
if (any(data > 100))
warning("Your data contain high values (> 100).
Make sure that your data (microarray signal) are in log-scale.\n")
if (nrowd < 100)
warning("Your dataset contains less than 100 lines. Are you sure you really
work on microarray data ? This function should
not be used with another type of data.")

if (check)
{
Expand Down
9 changes: 5 additions & 4 deletions man/DRomics.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ DRomics provides several functions for dose-response (or concentration-response)
\item and \code{\link{bmdcalc}} to derive a benchmark dose or concentration from each fitted curve.
}

The available version supports three types of data:
The available version supports three types of data and should not be used
with other types of data:
\itemize{
\item Single-channel microarray data (previously transformed in log2)
that must imported using the function\code{\link{microarraydata}},
that must imported using the function \code{\link{microarraydata}},
\item RNAseq (in raw counts) that must imported using the function
\code{\link{RNAseqdata}} and
\item metabolomic data that must imported using the function
Expand Down Expand Up @@ -54,8 +55,8 @@ Marie-Laure Delignette-Muller, Elise Billoir, Floriane Larras and Aurelie Siberc
## here cyclicloess normalization of a small microarray data set
## (sample of a real data set)

datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
(o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess"))
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
(o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))
plot(o)

# Step 2: item selection using the quadratic method
Expand Down
12 changes: 6 additions & 6 deletions man/RNAseqdata.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ Marie-Laure Delignette-Muller
# (in Toxicological sciences, 160, 95-110)
# Effect on kidney transcriptomes of tetrachloroethylene
#
datatxt <- system.file("extdata", "RNAseq_sample.txt", package="DRomics")
(o <- RNAseqdata(datatxt, check = TRUE, transfo.method = "rlog"))
datafilename <- system.file("extdata", "RNAseq_sample.txt", package="DRomics")
(o <- RNAseqdata(datafilename, check = TRUE, transfo.method = "rlog"))
plot(o)

# If you want to use your own data set just replace datatxt,
# If you want to use your own data set just replace datafilename,
# the first argument of RNAseqdata(),
# by the name of your data file (e.g. "mydata.txt")
#
Expand All @@ -124,14 +124,14 @@ plot(o)

# (2) transformation with two methods on the whole data set
\donttest{
datatxt <- system.file("extdata", "Zhou_kidney_pce.txt", package="DRomics")
datafilename <- system.file("extdata", "Zhou_kidney_pce.txt", package="DRomics")

# variance stabilizing tranformation
(o1 <- RNAseqdata(datatxt, check = TRUE, transfo.method = "vst"))
(o1 <- RNAseqdata(datafilename, check = TRUE, transfo.method = "vst"))
plot(o1)

# regularized logarithm
(o2 <- RNAseqdata(datatxt, check = TRUE, transfo.method = "vst"))
(o2 <- RNAseqdata(datafilename, check = TRUE, transfo.method = "vst"))
plot(o2)
}

Expand Down
10 changes: 5 additions & 5 deletions man/bmdboot.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ Marie-Laure Delignette-Muller
\examples{
# (1) a toy example (a very small subsample of a microarray data set)
#
datatxt <- system.file("extdata", "transcripto_very_small_sample.txt",
datafilename <- system.file("extdata", "transcripto_very_small_sample.txt",
package="DRomics")

# to test the package on a small but not very small data set
# use the following commented line
# datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
# datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")

o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess")
o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess")
s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001)
f <- drcfit(s_quad, progressbar = TRUE)
r <- bmdcalc(f)
Expand Down Expand Up @@ -167,9 +167,9 @@ b.lin.90$res
# (2) an example on a microarray data set (a subsample of a greater data set)
#
\donttest{
datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")

(o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess"))
(o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))
(s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001))
(f <- drcfit(s_quad, progressbar = TRUE))
(r <- bmdcalc(f))
Expand Down
12 changes: 6 additions & 6 deletions man/bmdcalc.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ Marie-Laure Delignette-Muller and Elise Billoir

# (1) a toy example (a very small subsample of a microarray data set)
#
datatxt <- system.file("extdata", "transcripto_very_small_sample.txt", package="DRomics")
datafilename <- system.file("extdata", "transcripto_very_small_sample.txt", package="DRomics")

# to test the package on a small (for a quick calculation) but not very small data set
# use the following commented line
# datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
# datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")

(o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess"))
(o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))
(s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.01))
(f <- drcfit(s_quad, progressbar = TRUE))
(r <- bmdcalc(f))
Expand All @@ -127,13 +127,13 @@ plot(rb)
# (2) an example on a microarray data set (a subsample of a greater data set)
#
\donttest{
datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")

# to test the package on a small (for a quick calculation) but not very small data set
# use the following commented line
# datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
# datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")

(o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess"))
(o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))
(s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.01))
(f <- drcfit(s_quad, progressbar = TRUE))
(r <- bmdcalc(f))
Expand Down
14 changes: 8 additions & 6 deletions man/curvesplot.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ curvesplot(extendedres, xmin = 0, xmax, y0shift = TRUE,

\arguments{
\item{extendedres}{the dataframe of results provided by bmdcalc (res) or drcfit (fitres)
or a subset of this data frame (selected lines) potentially extended with additional columns
coming for example from the annotation of items. This extended dataframe
or a subset of this data frame (selected lines). This dataframe can be extended
with additional columns coming for example from the annotation of items, and some lines
can be duplicated if their corresponding item has more than one annotation.
This extended dataframe
must at least contain the column giving the identification of each curve (\code{id}),
the column \code{model} naming the fitted model and the values of
the parameters (columns \code{b}, \code{c}, \code{d}, \code{e}, \code{f}).}
Expand Down Expand Up @@ -69,10 +71,10 @@ Marie-Laure Delignette-Muller

# A toy example on a very small subsample of a microarray data set)
#
datatxt <- system.file("extdata", "transcripto_very_small_sample.txt",
datafilename <- system.file("extdata", "transcripto_very_small_sample.txt",
package="DRomics")

o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess")
o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess")
s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.01)
f <- drcfit(s_quad, progressbar = TRUE)

Expand Down Expand Up @@ -109,9 +111,9 @@ curvesplot(f$fitres, xmax = max(f$omicdata$dose),

# (4) an example on a microarray data set (a subsample of a greater data set)
#
datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")

(o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess"))
(o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))
(s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001))
(f <- drcfit(s_quad, progressbar = TRUE))
(r <- bmdcalc(f))
Expand Down
10 changes: 5 additions & 5 deletions man/drcfit.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ Marie-Laure Delignette-Muller

# (1) a toy example (a very small subsample of a microarray data set)
#
datatxt <- system.file("extdata", "transcripto_very_small_sample.txt", package="DRomics")
datafilename <- system.file("extdata", "transcripto_very_small_sample.txt", package="DRomics")

# to test the package on a small (for a quick calculation) but not very small data set
# use the following commented line
# datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
# datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")

(o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess"))
(o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))
(s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.05))
(f <- drcfit(s_quad, progressbar = TRUE))

Expand All @@ -153,9 +153,9 @@ plot(f, plot.type = "fitted_residuals")
# (2) an example on a microarray data set (a subsample of a greater data set)
#
\donttest{
datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")

(o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess"))
(o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))
(s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.05))
(f <- drcfit(s_quad, progressbar = TRUE))

Expand Down
8 changes: 4 additions & 4 deletions man/ecdfplotwithCI.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ Marie-Laure Delignette-Muller

# (1) a toy example (a very small subsample of a microarray data set)
#
datatxt <- system.file("extdata", "transcripto_very_small_sample.txt",
datafilename <- system.file("extdata", "transcripto_very_small_sample.txt",
package="DRomics")
o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess")
o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess")
s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001)
f <- drcfit(s_quad, progressbar = TRUE)
r <- bmdcalc(f)
Expand All @@ -83,9 +83,9 @@ ecdfplotwithCI(variable = a$BMD.zSD, CI.lower = a$BMD.zSD.lower,
# (2) an example on a microarray data set (a subsample of a greater data set)
#
\donttest{
datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")

(o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess"))
(o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))
(s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001))
(f <- drcfit(s_quad, progressbar = TRUE))
(r <- bmdcalc(f))
Expand Down
4 changes: 2 additions & 2 deletions man/itemselect.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ Marie-Laure Delignette-Muller

# (1) an example on a microarray data set (a subsample of a greater data set)
#
datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")

(o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess"))
(o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))

# 1.a using the quadratic trend test
#
Expand Down
6 changes: 3 additions & 3 deletions man/metabolomicdata.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ Marie-Laure Delignette-Muller
# (1) import and check of metabolomic data
# (an example on a subsample of a greater data set)
#
datatxt <- system.file("extdata", "metabolo_sample.txt", package="DRomics")
datafilename <- system.file("extdata", "metabolo_sample.txt", package="DRomics")

o <- metabolomicdata(datatxt, check = TRUE)
o <- metabolomicdata(datafilename, check = TRUE)
print(o)
plot(o)

# If you want to use your own data set just replace datatxt,
# If you want to use your own data set just replace datafilename,
# the first argument of metabolomicdata(),
# by the name of your data file (e.g. "mydata.txt")
#
Expand Down
10 changes: 5 additions & 5 deletions man/microarraydata.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ Marie-Laure Delignette-Muller
# (1) import, check and normalization of microarray data
# (an example on a subsample of a greater data set)
#
datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess")
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess")
print(o)
plot(o)

# If you want to use your own data set just replace datatxt,
# If you want to use your own data set just replace datafilename,
# the first argument of microarraydata(),
# by the name of your data file (e.g. "mydata.txt")
#
Expand All @@ -122,9 +122,9 @@ plot(o)


# (2) normalization with other methods
(o.2 <- microarraydata(datatxt, check = TRUE, norm.method = "quantile"))
(o.2 <- microarraydata(datafilename, check = TRUE, norm.method = "quantile"))
plot(o.2)
(o.3 <- microarraydata(datatxt, check = TRUE, norm.method = "scale"))
(o.3 <- microarraydata(datafilename, check = TRUE, norm.method = "scale"))
plot(o.3)

}
4 changes: 2 additions & 2 deletions tests/examplewithLprobit.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
library(DRomics)
datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
(o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess"))
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
(o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))
(s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001))
(f <- drcfit(s_quad, sigmoid.model = "log-probit", progressbar = TRUE))
itemslP <- as.character(f$fitres[f$fitres$model == "log-probit",]$id)
Expand Down
4 changes: 2 additions & 2 deletions tests/examplewithRNAseq.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ library(DRomics)
# importation and check of RNAseq data and normalization
# with respect to library size and transformation
# options to put in shiny : transfo.method (2 methods, rlog or vst)
datatxt <- system.file("extdata", "RNAseq_sample.txt", package="DRomics")
(o <- RNAseqdata(datatxt, check = TRUE, transfo.method = "rlog"))
datafilename <- system.file("extdata", "RNAseq_sample.txt", package="DRomics")
(o <- RNAseqdata(datafilename, check = TRUE, transfo.method = "rlog"))
plot(o)

# item selection using the quadratic method
Expand Down
4 changes: 2 additions & 2 deletions tests/examplewithmetabolomic.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
library(DRomics)
# importation and check of metabolomic data
datatxt <- system.file("extdata", "metabolo_sample.txt", package="DRomics")
(o <- metabolomicdata(datatxt, check = TRUE))
datafilename <- system.file("extdata", "metabolo_sample.txt", package="DRomics")
(o <- metabolomicdata(datafilename, check = TRUE))
plot(o)

# item selection using the quadratic method
Expand Down
10 changes: 5 additions & 5 deletions tests/examplewithmicroarray.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ library(DRomics)
# importation and check of data and normalization if needed
# options to put in shiny : norm.method (4 methods)
## sample of the transcripto data set
datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
(o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess"))
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
(o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))
plot(o)
(o.2 <- microarraydata(datatxt, check = TRUE, norm.method = "none"))
(o.2 <- microarraydata(datafilename, check = TRUE, norm.method = "none"))
plot(o.2)
(o.3 <- microarraydata(datatxt, check = TRUE, norm.method = "quantile"))
(o.3 <- microarraydata(datafilename, check = TRUE, norm.method = "quantile"))
plot(o.3)
(o.4 <- microarraydata(datatxt, check = TRUE, norm.method = "scale"))
(o.4 <- microarraydata(datafilename, check = TRUE, norm.method = "scale"))
plot(o.4)

# item selection using the quadratic method
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_bmdcalc.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ test_that("bmdcalc works as expected on the BMD results",
{
skip_on_cran()
skip_on_os(c("mac", "linux", "solaris"))
datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess")
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess")
s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001)
f <- drcfit(s_quad, progressbar = TRUE)
r.1 <- bmdcalc(f, z = 1, x = 10)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_drcfit.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ test_that("drcfit works as expected on the model results",
{
skip_on_cran()
skip_on_os(c("mac", "linux", "solaris"))
datatxt <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
o <- microarraydata(datatxt, check = TRUE, norm.method = "cyclicloess")
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess")
s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001)
f <- drcfit(s_quad, progressbar = TRUE)
tmodel <- table(f$fitres$model)
Expand Down
Loading

0 comments on commit 56fbc0e

Please sign in to comment.