# (1) A toy example on a very small subsample of a microarray data set)
#
datafilename <- system.file("extdata", "transcripto_very_small_sample.txt",
package = "DRomics")
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)
# (1.a)
# Default plot of all the curves with BMD values added as points on the curve
#
curvesplot(r$res, xmax = max(f$omicdata$dose))
# \donttest{
# use of line size, point size, transparency
curvesplot(r$res, xmax = max(f$omicdata$dose),
line.alpha = 0.2, line.size = 1, point.alpha = 0.3, point.size = 1.8)
# the same plot with dose not in log scale
# fixing xmin and xmax
curvesplot(r$res, xmin = 0.1, xmax = max(f$omicdata$dose),
dose_log_transfo = FALSE, addBMD = TRUE)
# or not
curvesplot(r$res, dose_log_transfo = FALSE, addBMD = TRUE)
# plot of curves colored by models
curvesplot(r$res, xmax = max(f$omicdata$dose), colorby = "model")
# plot of curves facetted by item
curvesplot(r$res, xmax = max(f$omicdata$dose), facetby = "id")
# plot of curves facetted by trends
curvesplot(r$res, xmax = max(f$omicdata$dose), facetby = "trend")
# the same plot with free y scales
curvesplot(r$res, xmax = max(f$omicdata$dose), facetby = "trend",
free.y.scales = TRUE)
# (1.b)
# Plot of all the curves without shifting y0 values to 0
# and without scaling
curvesplot(r$res, xmax = max(f$omicdata$dose),
scaling = FALSE, y0shift = FALSE)
# (1.c)
# Plot of all the curves colored by model, with one facet per trend
#
curvesplot(r$res, xmax = max(f$omicdata$dose),
facetby = "trend", colorby = "model")
# changing the number of columns
curvesplot(r$res, xmax = max(f$omicdata$dose),
facetby = "trend", colorby = "model", ncol4faceting = 4)
# playing with size and transparency of lines
curvesplot(r$res, xmax = max(f$omicdata$dose),
facetby = "trend", colorby = "model",
line.size = 0.5, line.alpha = 0.8)
curvesplot(r$res, xmax = max(f$omicdata$dose),
facetby = "trend", colorby = "model",
line.size = 0.8, line.alpha = 0.2)
curvesplot(r$res, xmax = max(f$omicdata$dose),
facetby = "trend", line.size = 1, line.alpha = 0.2)
# (2) an example on a microarray data set (a subsample of a greater data set)
#
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 <- bmdcalc(f))
# plot split by trend and model with BMR-BMD points added on curves
# adding transparency
curvesplot(r$res, xmax = max(f$omicdata$dose),
line.alpha = 0.2, line.size = 0.8,
addBMD = TRUE, point.alpha = 0.2, point.size = 1.5,
facetby = "trend", facetby2 = "model")
# same plot without scaling and not in log dose scale
curvesplot(r$res, xmax = max(f$omicdata$dose),
line.alpha = 0.2, line.size = 0.8, dose_log_transfo = FALSE,
addBMD = TRUE, point.alpha = 0.2, point.size = 1.5,
scaling = FALSE, facetby = "trend", facetby2 = "model")
# (3) An example from data published by Larras et al. 2020
# in Journal of Hazardous Materials
# https://doi.org/10.1016/j.jhazmat.2020.122727
# a dataframe with metabolomic results (output $res of bmdcalc() or bmdboot() functions)
resfilename <- system.file("extdata", "triclosanSVmetabres.txt", package="DRomics")
res <- read.table(resfilename, header = TRUE, stringsAsFactors = TRUE)
str(res)
# a dataframe with annotation of each item identified in the previous file
# each item may have more than one annotation (-> more than one line)
annotfilename <- system.file("extdata", "triclosanSVmetabannot.txt", package="DRomics")
annot <- read.table(annotfilename, header = TRUE, stringsAsFactors = TRUE)
str(annot)
# Merging of both previous dataframes
# in order to obtain an extenderes dataframe
# bootstrap results and annotation
extendedres <- merge(x = res, y = annot, by.x = "id", by.y = "metab.code")
head(extendedres)
# Plot of the dose-response curves by pathway colored by trend
# with BMR-BMD points added on curves
curvesplot(extendedres, facetby = "path_class", npoints = 100, line.size = 0.5,
colorby = "trend", xmax = 7, addBMD = TRUE)
# The same plot not in log scale
curvesplot(extendedres, facetby = "path_class", npoints = 100, line.size = 0.5,
dose_log_transfo = FALSE, colorby = "trend", xmin = 0, xmax = 7)
# The same plot in log scale without scaling
curvesplot(extendedres, facetby = "path_class", npoints = 100, line.size = 0.5,
colorby = "trend", scaling = FALSE, xmax = 7)
# Plot of the dose-response curves split by pathway and by trend
# for a selection pathway
chosen_path_class <- c("Membrane transport", "Lipid metabolism")
ischosen <- is.element(extendedres$path_class, chosen_path_class)
curvesplot(extendedres[ischosen, ],
facetby = "trend", facetby2 = "path_class",
npoints = 100, line.size = 0.5, xmax = 7)
# Plot of the dose-response curves for a specific pathway
# in this example the "lipid metabolism" pathclass
LMres <- extendedres[extendedres$path_class == "Lipid metabolism", ]
curvesplot(LMres, facetby = "id", npoints = 100, line.size = 0.8, point.size = 2,
colorby = "trend", xmax = 7)
# }
Run the code above in your browser using DataLab