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. > # Test DRomics on datasets with NA values > # possible especially for apical data > library(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 of plots > > if (visualize) + { + ########### Example on apical data ################ + ################################################### + data(Scenedesmus_apical) + head(Scenedesmus_apical) + set.seed(1234) + + # build of a dataset with NA values + Scenedesmus_apical2 <- Scenedesmus_apical + Scenedesmus_apical2[3, ] <- Scenedesmus_apical2[2, ] + Scenedesmus_apical2[2, 2] <- NA + Scenedesmus_apical2[3, 27] <- NA + Scenedesmus_apical2[3, 1] <- "growthbis" + head(Scenedesmus_apical2) + + (o <- continuousanchoringdata(Scenedesmus_apical2, backgrounddose = 0.1)) + plot(o) + o$data + complete.cases(o$data) + sum(complete.cases(o$data)) + o$data.mean + (s <- itemselect(o, select.method = "quadratic")) + (f <- drcfit(s)) + plot(f) + (r <- bmdcalc(f)) + r$res + (b <- bmdboot(r)) + b$res + + (f.AIC <- drcfit(s, information.criterion = "AIC")) + (f.BIC <- drcfit(s, information.criterion = "BIC")) + + ## comparison with the individual fit for growth + Scenedesmus_apical3 <- Scenedesmus_apical2[1:2, ] + Scenedesmus_apical3 <- Scenedesmus_apical3[, -2] # remove of the column with NA + head(Scenedesmus_apical3) + + (o3 <- continuousanchoringdata(Scenedesmus_apical3, backgrounddose = 0.1)) + plot(o3) + (s3 <- itemselect(o3, select.method = "quadratic")) + (f3 <- drcfit(s3)) + plot(f3) + (r3 <- bmdcalc(f3)) + r3$res + + (b3 <- bmdboot(r3)) + b3$res + b$res + + ########### Example on metabolomic data ################ + ######################################################## + data(Scenedesmus_metab) + head(Scenedesmus_metab) + set.seed(1234) + + # build of a dataset with NA values + Scenedesmus_metab2 <- Scenedesmus_metab1 <- Scenedesmus_metab[1:50, ] + Scenedesmus_metab2[, 1] + # Put NA values on a non selected item (line) + # and on a selected item (line 23 item "NAP_24") + Scenedesmus_metab2[2, 2] <- NA + Scenedesmus_metab2[23, 5] <- NA + Scenedesmus_metab2[23, 4] <- NA + + (o1 <- continuousomicdata(Scenedesmus_metab1)) + plot(o1) + (o2 <- continuousomicdata(Scenedesmus_metab2, check = FALSE)) + plot(o2) + + (s1 <- itemselect(o1, select.method = "quadratic")) + (s2 <- itemselect(o2, select.method = "quadratic")) + + (f1 <- drcfit(s1)) + plot(f1, items = "NAP_24") + (f2 <- drcfit(s2)) + plot(f2, items = "NAP_24") + + f1$fitres[1:3, ] + f2$fitres[1:3, ] + + (f2.AIC <- drcfit(s2, information.criterion = "AIC")) + (f2.BIC <- drcfit(s2, information.criterion = "BIC")) + + (r1 <- bmdcalc(f1)) + r1$res[1:2, ] + (r2 <- bmdcalc(f2)) + r2$res[1:2, ] + + (b1 <- bmdboot(r1, niter = 100)) + b1$res[1:2, ] + (b2 <- bmdboot(r2, niter = 100)) + b2$res[1:2, ] + + + # Trial with NA values for each replicate of a dose + Scenedesmus_metab3 <- Scenedesmus_metab1 + Scenedesmus_metab3[c(1,23), ] + # Put NA values for each replicate for dose 1.79 (line 23 item "NAP_24") + Scenedesmus_metab3[23, 11] <- NA + Scenedesmus_metab3[23, 20] <- NA + Scenedesmus_metab3[23, 21] <- NA + (o3 <- continuousomicdata(Scenedesmus_metab3)) + plot(o3) + + (s3 <- itemselect(o3, select.method = "quadratic")) + + (f3 <- drcfit(s3)) + plot(f3, items = "NAP_24") + plot(f1, items = "NAP_24") + + f3$fitres[1:5, ] + f1$fitres[1:5, ] + + (r3 <- bmdcalc(f3)) + + (b3 <- bmdboot(r3, niter = 100)) + b3$res[1:5, ] + b1$res[1:5, ] + + ################## example with microarray or RNAseq data ############# + ## It should stop + data(Zhou_kidney_pce) + Zhou <- Zhou_kidney_pce[1:1000, ] + Zhou[10,10] <- NA + try(RNAseqdata(Zhou)) + + try(microarraydata(Zhou)) + } > > proc.time() user system elapsed 9.34 0.68 10.03