From 3427a649790b975f71837227ef0bc6a4173186fe Mon Sep 17 00:00:00 2001 From: Marie-Laure DELIGNETTE-MULLER Date: Tue, 22 Sep 2020 21:29:13 +0200 Subject: [PATCH] another trial to lighten examples and tests for passing CRAN check --- man/RNAseqdata.Rd | 8 +++--- man/Scenedesmus.Rd | 4 ++- man/Zhou.Rd | 3 +- man/bmdcalc.Rd | 4 ++- man/bmdplotwithgradient.Rd | 2 -- man/continuousanchoringdata.Rd | 8 ++++-- man/curvesplot.Rd | 7 ++--- man/drcfit.Rd | 14 +++++----- man/ecdfplotwithCI.Rd | 6 ++-- man/itemselect.Rd | 3 ++ man/microarraydata.Rd | 5 +++- man/targetplot.Rd | 3 ++ tests/examplewithRNAseq.R | 47 +++++++++++++------------------- tests/examplewithanchoringdata.R | 15 ++++++---- tests/examplewithmetabolomic.R | 19 ++++++++----- tests/examplewithmicroarray.R | 24 ++++++++++------ 16 files changed, 97 insertions(+), 75 deletions(-) diff --git a/man/RNAseqdata.Rd b/man/RNAseqdata.Rd index e37ab6e..472030b 100644 --- a/man/RNAseqdata.Rd +++ b/man/RNAseqdata.Rd @@ -126,8 +126,8 @@ Marie-Laure Delignette-Muller # (see ? Zhou for details) # datafilename <- system.file("extdata", "RNAseq_sample.txt", package="DRomics") -(o <- RNAseqdata(datafilename, check = TRUE, transfo.method = "rlog")) -plot(o) +(o <- RNAseqdata(datafilename, check = TRUE, transfo.method = "vst")) +plot(o, range = 1e6) # If you want to use your own data set just replace datafilename, # the first argument of RNAseqdata(), @@ -143,8 +143,8 @@ plot(o) # Zhou_kidney_pce (see ?Zhou for details) data(Zhou_kidney_pce) subsample <- Zhou_kidney_pce[1:1000, ] -(o <- RNAseqdata(subsample, check = TRUE, transfo.method = "rlog")) -plot(o) +(o <- RNAseqdata(subsample, check = TRUE, transfo.method = "vst")) +plot(o, range = 1e6) # (2) transformation with two methods on the whole data set diff --git a/man/Scenedesmus.Rd b/man/Scenedesmus.Rd index 69cff37..aec1766 100644 --- a/man/Scenedesmus.Rd +++ b/man/Scenedesmus.Rd @@ -42,6 +42,8 @@ data(Scenedesmus_metab) head(Scenedesmus_metab) str(Scenedesmus_metab) +\donttest{ + # (1.2) import and check of metabolomics data # (o_metab <- metabolomicdata(Scenedesmus_metab)) @@ -76,7 +78,7 @@ r_apical <- bmdcalc(f_apical, z = 1) r_apical$res - +} } \keyword{ datasets }% at least one, from doc/KEYWORDS diff --git a/man/Zhou.Rd b/man/Zhou.Rd index e11ccf4..c6105b6 100644 --- a/man/Zhou.Rd +++ b/man/Zhou.Rd @@ -48,6 +48,8 @@ head(Zhou_liver_pce) data(Zhou_liver_tce) head(Zhou_liver_tce) +\donttest{ + # (2) import, check, normalization and transformation of a sample # of one of those datasets # @@ -59,7 +61,6 @@ plot(o) # (3) analysis of the whole dataset (for kidney and PCE) # (may be long to run) -\donttest{ d <- Zhou_kidney_pce (o <- RNAseqdata(d)) plot(o) diff --git a/man/bmdcalc.Rd b/man/bmdcalc.Rd index ed3f8b4..3903369 100644 --- a/man/bmdcalc.Rd +++ b/man/bmdcalc.Rd @@ -121,8 +121,10 @@ datafilename <- system.file("extdata", "transcripto_very_small_sample.txt", pack plot(r) # changing the values of z and x for BMD calculation +\donttest{ (rb <- bmdcalc(f, z = 2, x = 50)) -plot(rb) +plot(rb) +} # (2) an example on a microarray data set (a subsample of a greater data set) # diff --git a/man/bmdplotwithgradient.Rd b/man/bmdplotwithgradient.Rd index 8240f7b..bf53f8b 100644 --- a/man/bmdplotwithgradient.Rd +++ b/man/bmdplotwithgradient.Rd @@ -152,7 +152,6 @@ bmdplotwithgradient(r$res, BMDtype = "zSD", # bmdplotwithgradient(r$res, BMDtype = "zSD", facetby = "trend", shapeby = "model") -} # (2) # Plot of BMD values with color dose-response gradient @@ -187,7 +186,6 @@ bmdplotwithgradient(extendedres, BMDtype = "zSD", facetby = "path_class", shapeby = "trend") -\donttest{ # (2.b) The same example forcing the limits of the colour gradient at other # values than observed minimal and maximal values of the signal bmdplotwithgradient(extendedres, BMDtype = "zSD", diff --git a/man/continuousanchoringdata.Rd b/man/continuousanchoringdata.Rd index 598f078..f8ca516 100644 --- a/man/continuousanchoringdata.Rd +++ b/man/continuousanchoringdata.Rd @@ -98,8 +98,9 @@ datafilename <- system.file("extdata", "apical_anchoring.txt", package = "DRomic o <- continuousanchoringdata(datafilename, check = TRUE) print(o) +\donttest{ plot(o) - +} # If you want to use your own data set just replace datafilename, # the first argument of continuousanchoringdata(), # by the name of your data file (e.g. "mydata.txt") @@ -112,8 +113,11 @@ plot(o) # Use of an R object of class data.frame # on the same example (see ?Scenedesmus for details) data(Scenedesmus_apical) -(o <- continuousanchoringdata(Scenedesmus_apical)) +o <- continuousanchoringdata(Scenedesmus_apical) +print(o) +\donttest{ plot(o) +} } diff --git a/man/curvesplot.Rd b/man/curvesplot.Rd index 827937d..e85e00f 100644 --- a/man/curvesplot.Rd +++ b/man/curvesplot.Rd @@ -89,6 +89,8 @@ f <- drcfit(s_quad, progressbar = TRUE) # curvesplot(f$fitres, xmax = max(f$omicdata$dose)) +\donttest{ + # the same plot with dose in log scale (need x != 0 in input) curvesplot(f$fitres, xmin = 0.1, xmax = max(f$omicdata$dose), dose_log_transfo = TRUE) @@ -107,9 +109,6 @@ curvesplot(r$res, xmax = max(f$omicdata$dose), facetby = "trend") curvesplot(r$res, xmax = max(f$omicdata$dose), facetby = "trend", free.y.scales = TRUE) - -\donttest{ - # (2) # Plot of all the curves without shifting y0 values to 0 # @@ -136,7 +135,6 @@ datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomic (r <- bmdcalc(f)) curvesplot(f$fitres, xmax = max(f$omicdata$dose), facetby = "typology") -} # (5) An example from data published by Larras et al. 2020 @@ -169,3 +167,4 @@ curvesplot(LMres, facetby = "id", npoints = 100, line.size = 1, } +} diff --git a/man/drcfit.Rd b/man/drcfit.Rd index e7bea22..0e4ee08 100644 --- a/man/drcfit.Rd +++ b/man/drcfit.Rd @@ -153,9 +153,9 @@ datafilename <- system.file("extdata", "transcripto_very_small_sample.txt", pack # use the following commented line # 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.05)) -(f <- drcfit(s_quad, progressbar = TRUE)) +o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess") +s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.05) +f <- drcfit(s_quad, progressbar = TRUE) # Default plot plot(f) @@ -177,11 +177,11 @@ plot(f, plot.type = "dose_residuals", dose_log_transfo = TRUE) # plot of residuals as function of the fitted value plot(f, plot.type = "fitted_residuals") -} + # (2) an example on a microarray data set (a subsample of a greater data set) # -\donttest{ + datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics") (o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess")) @@ -202,15 +202,15 @@ head(f$fitres) # Look at the table of results for unsuccessful fits head(f$unfitres) -} # (3) Comparison of parallel and non paralell implementations on a # larger selection of items # - \donttest{ + s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.05) system.time(f1 <- drcfit(s_quad, progressbar = TRUE)) system.time(f2 <- drcfit(s_quad, progressbar = FALSE, parallel = "snow", ncpus = 2)) + } } diff --git a/man/ecdfplotwithCI.Rd b/man/ecdfplotwithCI.Rd index 1c892f9..90b1069 100644 --- a/man/ecdfplotwithCI.Rd +++ b/man/ecdfplotwithCI.Rd @@ -65,11 +65,11 @@ s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001) f <- drcfit(s_quad, progressbar = TRUE) r <- bmdcalc(f) set.seed(1) # to get reproducible results with a so small number of iterations -(b <- bmdboot(r, niter = 10)) # with a non reasonable value for niter +b <- bmdboot(r, niter = 5) # with a non reasonable value for niter # !!!! TO GET CORRECT RESULTS # !!!! niter SHOULD BE FIXED FAR LARGER , e.g. to 1000 # !!!! but the run will be longer -b$res + # manual ecdf plot of the bootstrap results as an ecdf distribution # on BMD, plot that could also be obtained with plot(b) # in this simple case @@ -78,6 +78,7 @@ a <- b$res[is.finite(b$res$BMD.zSD.upper), ] ecdfplotwithCI(variable = a$BMD.zSD, CI.lower = a$BMD.zSD.lower, CI.upper = a$BMD.zSD.upper, CI.col = "red") +\donttest{ # (2) An example from data published by Larras et al. 2020 # in Journal of Hazardous Materials @@ -120,7 +121,6 @@ ecdfplotwithCI(variable = annotres$BMD.zSD, # (3) an example on a microarray data set (a subsample of a greater data set) # -\donttest{ datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics") (o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess")) diff --git a/man/itemselect.Rd b/man/itemselect.Rd index f6095d5..65228c2 100644 --- a/man/itemselect.Rd +++ b/man/itemselect.Rd @@ -129,6 +129,8 @@ datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomic # (s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.05)) +\donttest{ + # 1.b using the linear trend test # (s_lin <- itemselect(o, select.method = "linear", FDR = 0.05)) @@ -142,3 +144,4 @@ datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomic (s_quad.2 <- itemselect(o, select.method = "quadratic", FDR = 0.001)) } +} diff --git a/man/microarraydata.Rd b/man/microarraydata.Rd index d3c2bb5..e1c78c7 100644 --- a/man/microarraydata.Rd +++ b/man/microarraydata.Rd @@ -112,7 +112,8 @@ Marie-Laure Delignette-Muller # (an example on a subsample of a greater data set published in Larras et al. 2018 # Transcriptomic effect of triclosan in the chlorophyte Scenedesmus vacuolatus) # -datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics") +datafilename <- system.file("extdata", "transcripto_very_small_sample.txt", + package="DRomics") o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess") print(o) plot(o) @@ -126,6 +127,7 @@ plot(o) # when it is used with its default field separator (sep argument) # Tabs are recommended. +\donttest{ # (2) normalization with other methods (o.2 <- microarraydata(datafilename, check = TRUE, norm.method = "quantile")) @@ -134,3 +136,4 @@ plot(o.2) plot(o.3) } +} diff --git a/man/targetplot.Rd b/man/targetplot.Rd index 16a34c3..bc7c5d7 100644 --- a/man/targetplot.Rd +++ b/man/targetplot.Rd @@ -53,6 +53,8 @@ f <- drcfit(s_quad, progressbar = TRUE) targetitems <- c("88.1", "1", "3", "15") targetplot(targetitems, f = f) +\donttest{ + # The same plot in x log scale # targetplot(targetitems, f = f, dose_log_transfo = TRUE) @@ -67,3 +69,4 @@ targetplot(targetitems, f = f, dose_log_transfo = TRUE) + targetplot(targetitems, f = f, add.fit = FALSE) } +} diff --git a/tests/examplewithRNAseq.R b/tests/examplewithRNAseq.R index 83be826..730c3c5 100644 --- a/tests/examplewithRNAseq.R +++ b/tests/examplewithRNAseq.R @@ -1,12 +1,13 @@ library(DRomics) visualize <- FALSE # put to TRUE for a manual check of plots +doboot <- FALSE # 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) datafilename <- system.file("extdata", "RNAseq_sample.txt", package="DRomics") (o <- RNAseqdata(datafilename, check = TRUE, transfo.method = "vst")) -plot(o) +plot(o, range = 1e6) if (visualize) # too long computation ! { @@ -48,27 +49,18 @@ if(visualize) # too long computation ! } -# item selection using the quadratic method -# options to put in shiny : select.method (3 methods), FDR (numerical positive value < 1) -(s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001)) if (visualize) { + # item selection using the quadratic method +# options to put in shiny : select.method (3 methods), FDR (numerical positive value < 1) + (s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001)) (s_lin <- itemselect(o, select.method = "linear", FDR = 0.001)) (s_ANOVA <- itemselect(o, select.method = "ANOVA", FDR = 0.001)) -} -# no options in shiny -(f <- drcfit(s_quad, progressbar = TRUE)) -if (visualize) -{ + (f <- drcfit(s_quad, progressbar = TRUE)) f$fitres plot(f) -} - - -if (visualize) -{ # various plot of fitted curves (without data) curvesplot(f$fitres, xmax = max(f$omicdata$dose), facetby = "model", colorby = "model") @@ -79,10 +71,6 @@ if (visualize) curvesplot(f$fitres[f$fitres$trend == "bell", ], xmax = max(f$omicdata$dose), facetby = "id") -} - -if (visualize) -{ curvesplot(f$fitres[f$fitres$trend == "U", ], xmax = max(f$omicdata$dose), facetby = "id") } @@ -90,15 +78,14 @@ if (visualize) # calculation of benchmark doses # options in shiny : z (numerical positive value), x (numerical positive value : percentage) -(r <- bmdcalc(f, z = 1, x = 10)) -if (visualize) -(r.2 <- bmdcalc(f, z = 2, x = 50)) +if (visualize) +{ + (r <- bmdcalc(f, z = 1, x = 10)) + (r.2 <- bmdcalc(f, z = 2, x = 50)) # plot of BMD # options in shiny : BMDtype (2 possibilities), plottype (3 possibilities), by (3 possibilities) # hist.bins (integer for hist only) -if (visualize) -{ plot(r, BMDtype = "zSD", plottype = "ecdf", by = "none") plot(r, BMDtype = "xfold", plottype = "ecdf", by = "none") @@ -109,11 +96,15 @@ if (visualize) plot(r, plottype = "hist", by = "trend", hist.bins = 10) } -# Calculation of confidence intervals on BMDs by Bootstrap -niter <- 1000 -niter <- 10 -b <- bmdboot(r, niter = niter) # niter should be fixed at least at 1000 to get a reasonable precision -if (visualize) plot(b) +if (doboot) +{ + # Calculation of confidence intervals on BMDs by Bootstrap + niter <- 1000 + niter <- 10 + b <- bmdboot(r, niter = niter) # niter should be fixed at least at 1000 to get a reasonable precision + if (visualize) plot(b) + +} if(visualize) # too long computation ! { diff --git a/tests/examplewithanchoringdata.R b/tests/examplewithanchoringdata.R index 686abca..5ad4458 100644 --- a/tests/examplewithanchoringdata.R +++ b/tests/examplewithanchoringdata.R @@ -1,5 +1,6 @@ library(DRomics) visualize <- FALSE # put to TRUE for a manual check of plots +doboot <- FALSE # importation and check of apical anchoring data # datafilename <- system.file("extdata", "apical_anchoring.txt", package="DRomics") @@ -59,8 +60,12 @@ if (visualize) } # Calculation of confidence intervals on BMDs by Bootstrap -niter <- 1000 -niter <- 10 -(b <- bmdboot(r, niter = niter)) # niter should be fixed at least at 1000 to get a reasonable precision -if (visualize) - plot(b) +if (doboot) +{ + niter <- 1000 + niter <- 10 + (b <- bmdboot(r, niter = niter)) # niter should be fixed at least at 1000 to get a reasonable precision + if (visualize) + plot(b) + +} diff --git a/tests/examplewithmetabolomic.R b/tests/examplewithmetabolomic.R index 95eb46f..bbd2d7c 100644 --- a/tests/examplewithmetabolomic.R +++ b/tests/examplewithmetabolomic.R @@ -1,5 +1,6 @@ library(DRomics) visualize <- FALSE # put to TRUE for a manual check of plots +doboot <- FALSE # importation and check of metabolomic data datafilename <- system.file("extdata", "metabolo_sample.txt", package="DRomics") @@ -60,11 +61,15 @@ if (visualize) } -niter <- 1000 -niter <- 10 - -# Calculation of confidence intervals on BMDs by Bootstrap -b <- bmdboot(r, niter = niter) # niter should be fixed at least at 1000 to get a reasonable precision -if (visualize) -plot(b) +if (doboot) +{ + niter <- 1000 + niter <- 10 + + # Calculation of confidence intervals on BMDs by Bootstrap + b <- bmdboot(r, niter = niter) # niter should be fixed at least at 1000 to get a reasonable precision + if (visualize) + plot(b) + +} diff --git a/tests/examplewithmicroarray.R b/tests/examplewithmicroarray.R index 45495ab..902e6ee 100644 --- a/tests/examplewithmicroarray.R +++ b/tests/examplewithmicroarray.R @@ -1,5 +1,6 @@ library(DRomics) visualize <- FALSE # put to TRUE for a manual check of plots +doboot <- FALSE # importation and check of data and normalization if needed # options to put in shiny : norm.method (4 methods) @@ -7,11 +8,12 @@ visualize <- FALSE # put to TRUE for a manual check of plots datafilename <- system.file("extdata", "transcripto_very_small_sample.txt", package="DRomics") (o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess")) plot(o) -(o.2 <- microarraydata(datafilename, check = TRUE, norm.method = "none")) -(o.3 <- microarraydata(datafilename, check = TRUE, norm.method = "quantile")) -(o.4 <- microarraydata(datafilename, check = TRUE, norm.method = "scale")) if (visualize) { + (o.2 <- microarraydata(datafilename, check = TRUE, norm.method = "none")) + (o.3 <- microarraydata(datafilename, check = TRUE, norm.method = "quantile")) + (o.4 <- microarraydata(datafilename, check = TRUE, norm.method = "scale")) + plot(o.2) plot(o.3) plot(o.4) @@ -76,9 +78,13 @@ if (visualize) } # Calculation of confidence intervals on BMDs by Bootstrap -niter <- 1000 -niter <- 10 -b <- bmdboot(r, niter = niter) # niter should be fixed at least at 1000 to get a reasonable precision - -if (visualize) -plot(b) +if (doboot) +{ + niter <- 1000 + niter <- 10 + b <- bmdboot(r, niter = niter) # niter should be fixed at least at 1000 to get a reasonable precision + + if (visualize) + plot(b) + +}