# (1) a toy example (a very small subsample of a microarray data set)
#
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
# 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))
# Default plot
plot(f)
# \donttest{
# The same plot without log transformation of the doses
# (in raw scale of doses)
plot(f, dose_log_transfo = FALSE)
# The same plot in x log scale choosing x limits for plot
if (require(ggplot2))
plot(f, dose_log_transfo = TRUE) +
scale_x_log10(limits = c(0.1, 10))
# Plot of residuals as function of the dose
plot(f, plot.type = "dose_residuals")
# Same plot of residuals without log transformation of the doses
plot(f, plot.type = "dose_residuals", dose_log_transfo = FALSE)
# 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)
#
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))
# Default plot
plot(f)
# save all plots to pdf using plotfit2pdf()
plotfit2pdf(f, path2figs = tempdir())
plotfit2pdf(f, plot.type = "fitted_residuals",
nrowperpage = 9, ncolperpage = 6, path2figs = tempdir())
# Plot of the fit of the first 12 most responsive items
plot(f, items = 12)
# Plot of the chosen items in the chosen order
plot(f, items = c("301.2", "363.1", "383.1"))
# Look at the table of results for successful fits
head(f$fitres)
# Look at the table of results for unsuccessful fits
head(f$unfitres)
# count the number of unsuccessful fits for each cause
table(f$unfitres$cause)
# (3) Comparison of parallel and non paralell implementations on a larger selection of items
#
if(!requireNamespace("parallel", quietly = TRUE)) {
if(parallel::detectCores() > 1) {
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))
}}
# }
Run the code above in your browser using DataLab