R Under development (unstable) (2024-01-29 r85841 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > require(DRomics) Loading required package: DRomics Loading required package: limma Loading required package: DESeq2 Loading required package: S4Vectors Loading required package: stats4 Loading required package: BiocGenerics Attaching package: 'BiocGenerics' The following object is masked from 'package:limma': plotMA The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append, as.data.frame, basename, cbind, colnames, dirname, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rownames, sapply, setdiff, table, tapply, union, unique, unsplit, which.max, which.min Attaching package: 'S4Vectors' The following object is masked from 'package:utils': findMatches The following objects are masked from 'package:base': I, expand.grid, unname Loading required package: IRanges Attaching package: 'IRanges' The following object is masked from 'package:grDevices': windows Loading required package: GenomicRanges Loading required package: GenomeInfoDb Loading required package: SummarizedExperiment Loading required package: MatrixGenerics Loading required package: matrixStats Attaching package: 'MatrixGenerics' The following objects are masked from 'package:matrixStats': colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse, colCounts, colCummaxs, colCummins, colCumprods, colCumsums, colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs, colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats, colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds, colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads, colWeightedMeans, colWeightedMedians, colWeightedSds, colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet, rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods, rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps, rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins, rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks, rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars, rowWeightedMads, rowWeightedMeans, rowWeightedMedians, rowWeightedSds, rowWeightedVars Loading required package: Biobase Welcome to Bioconductor Vignettes contain introductory material; view with 'browseVignettes()'. To cite Bioconductor, see 'citation("Biobase")', and for packages 'citation("pkgname")'. Attaching package: 'Biobase' The following object is masked from 'package:MatrixGenerics': rowMedians The following objects are masked from 'package:matrixStats': anyMissing, rowMedians DRomics has been loaded. !!!! IMPORTANT CHANGES IN DEFAULT PLOT ARGUMENTS !!!! Now all the plot functions use by default a log10 scale for dose and BMD values, except curvesplot(), for which the use of a dose log scale requires the specification by the user of a non null minimal value (xmin). We also put the default value of the argument scaling at TRUE in curvesplot() and bmdplotwithgradient(), to focus on shapes of dose-responses rather than on their amplitude. > visualize <- FALSE # put to TRUE for a manual check > > if (visualize) + { + # (1) 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 + annotres <- merge(x = res, y = annot, by.x = "id", by.y = "metab.code") + head(annotres) + + ### an ECDFplot of 25th quantiles of BMD-zSD calculated by pathway + sensitivityplot(annotres, BMDtype = "zSD", + group = "path_class", + BMDsummary = "first.quartile") + + + subannotres <- selectgroups(annotres, + group = "path_class", + BMDmax = 5, + BMDtype = "zSD", + BMDsummary = "first.quartile", + nitemsmin = 10) + + sensitivityplot(subannotres, BMDtype = "zSD", + group = "path_class", + BMDsummary = "first.quartile") + + subannotres <- selectgroups(annotres, + group = "path_class", + BMDmax = 1, + BMDtype = "zSD", + BMDsummary = "first.quartile", + nitemsmin = 3) + + sensitivityplot(subannotres, BMDtype = "zSD", + group = "path_class", + BMDsummary = "first.quartile") + + # using the median + sensitivityplot(annotres, BMDtype = "zSD", + group = "path_class", + BMDsummary = "median") + + subannotres <- selectgroups(annotres, + group = "path_class", + BMDmax = 2, + BMDtype = "zSD", + BMDsummary = "median", + nitemsmin = 3) + + sensitivityplot(subannotres, BMDtype = "zSD", + group = "path_class", + BMDsummary = "median", + BMD_log_transfo = FALSE) + + # same plot in log10 BMD scale + sensitivityplot(annotres, BMDtype = "zSD", + group = "path_class", + BMDsummary = "first.quartile", + BMD_log_transfo = TRUE) + + ### Plot of 25th quantiles of BMD-zSD calculated by pathway + ### in the order of the levels as defined in the group input + levels(annotres$path_class) + sensitivityplot(annotres, BMDtype = "zSD", + group = "path_class", ECDF_plot = FALSE, + BMDsummary = "first.quartile") + + ### an ECDFplot of medians of BMD-zSD calculated by pathway + sensitivityplot(annotres, BMDtype = "zSD", + group = "path_class", + BMDsummary = "median") + + ### an ECDFplot of medians of BMD-zSD calculated by pathway + ### with addition of interquartile ranges (IQRs) + sensitivityplot(annotres, BMDtype = "zSD", + group = "path_class", + BMDsummary = "median.and.IQR") + + # (2) + # An example with two molecular levels + # + ### Rename metabolomic results + metabextendedres <- annotres + + # Import the dataframe with transcriptomic results + contigresfilename <- system.file("extdata", "triclosanSVcontigres.txt", package = "DRomics") + contigres <- read.table(contigresfilename, header = TRUE, stringsAsFactors = TRUE) + str(contigres) + + # Import the dataframe with functional annotation (or any other descriptor/category + # you want to use, here KEGG pathway classes) + contigannotfilename <- system.file("extdata", "triclosanSVcontigannot.txt", package = "DRomics") + contigannot <- read.table(contigannotfilename, header = TRUE, stringsAsFactors = TRUE) + str(contigannot) + + # Merging of both previous dataframes + contigextendedres <- merge(x = contigres, y = contigannot, by.x = "id", by.y = "contig") + # to see the structure of this dataframe + str(contigextendedres) + + ### Merge metabolomic and transcriptomic results + extendedres <- rbind(metabextendedres, contigextendedres) + extendedres$molecular.level <- factor(c(rep("metabolites", nrow(metabextendedres)), + rep("contigs", nrow(contigextendedres)))) + str(extendedres) + + ### Plot of 25th quantiles of BMD-zSD calculated by pathway + ### and colored by molecular level + # optional inverse alphabetic ordering of groups for the plot + extendedres$path_class <- factor(extendedres$path_class, + levels = sort(levels(extendedres$path_class), + decreasing = TRUE)) + sensitivityplot(extendedres, BMDtype = "zSD", + group = "path_class", colorby = "molecular.level", + BMDsummary = "first.quartile") + + subextendedres <- selectgroups(extendedres, + group = "path_class", + explev = "molecular.level", + BMDmax = 5, + BMDtype = "zSD", + BMDsummary = "first.quartile", + nitemsmin = 10) + + sensitivityplot(subextendedres, BMDtype = "zSD", + group = "path_class", colorby = "molecular.level", + BMDsummary = "first.quartile") + + subextendedres <- selectgroups(extendedres, + group = "path_class", + explev = "molecular.level", + BMDmax = 1, + BMDtype = "zSD", + BMDsummary = "first.quartile", + nitemsmin = 3) + + sensitivityplot(subextendedres, BMDtype = "zSD", + group = "path_class", colorby = "molecular.level", + BMDsummary = "first.quartile") + + } > > proc.time() user system elapsed 8.85 0.95 9.81