I have run a DEXSeq analysis according to the vignette and run into the following error after executing testForDEU():
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘mcols’ for signature ‘"matrix"’
The traceback of this error was the following:
> traceback() 4: stop(gettextf("unable to find an inherited method for function %s for signature %s", sQuote(fdef@generic), sQuote(cnames)), domain = NA) 3: (function (classes, fdef, mtable) { methods <- .findInheritedMethods(classes, fdef, mtable) if (length(methods) == 1L) return(methods[[1L]]) else if (length(methods) == 0L) { cnames <- paste0("\"", vapply(classes, as.character, ""), "\"", collapse = ", ") stop(gettextf("unable to find an inherited method for function %s for signature %s", sQuote(fdef@generic), sQuote(cnames)), domain = NA) } else stop("Internal error in finding inherited methods; didn't return a unique method", domain = NA) })(list("matrix"), function (x, use.names = FALSE, ...) standardGeneric("mcols"), <environment>) 2: mcols(mergeObject) 1: testForDEU(DEX.data)
However, mcols(DEX.data) before running testForDEU seems to be fine and is of class DataFrame (as expected). The error occurs despite the fact that there are no warnings / errors in any of the previous steps. I have updated all my packages (did not help) and am running the latest R version (see below). Does anyone have any suggestions as to how to solve this?
My code was as follows:
######## Preprocessing ## Set variables gtf.file <- "~/Peeper/Resources/Tophat_GTF/Hs66.gtf" flattened.gff.file <- "~/Peeper/Resources/Tophat_GTF/Hs66.DEXSeq.chr.gff" ## Execute python scripts pythonScriptsDir <- system.file("python_scripts", package = "DEXSeq") system(paste("python", file.path(pythonScriptsDir, "dexseq_prepare_annotation.py"), gtf.file, flattened.gff.file)) ## Loop over bam files to execute DEXseq python script bam.files <- list.files(pattern = ".bam$", recursive = TRUE) ## If files are sorted by sort -k 1,1 already: library(BiocParallel) bp.param <- SnowParam(workers = 8) DexseqCount <- function(bam.files, pythonScriptsDir, flattened.gff.file) { system(paste("samtools view", bam.files, "| python", file.path(pythonScriptsDir, "dexseq_count.py"), "--paired=no --stranded=no", flattened.gff.file, "-", gsub("accepted_hits.bam$", "dexseq_counts.txt", bam.files))) } bplapply(bam.files, DexseqCount, pythonScriptsDir, flattened.gff.file, BPPARAM = bp.param) ## Create sample.annotation count.files <- list.files(pattern = "dexseq_counts.txt$", recursive = TRUE) sample.annotation <- data.frame(row.names = dirname(bam.files), responder = c("responder", "non-responder")[c(2, 1, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 1, 1, 2, 2, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 1, 2, 2)]) ###### Relevant DEXSeq analysis ## Load library & create DEXSeqDataSet suppressPackageStartupMessages(library("DEXSeq")) DEX.data <- DEXSeqDataSetFromHTSeq(count.files, sampleData = sample.annotation, design = ~ responder + exon, flattenedfile = flattened.gff.file) ## Estimate size factors & dispersions DEX.data <- estimateSizeFactors(DEX.data) DEX.data <- estimateDispersions(DEX.data, BPPARAM = bp.param) save(DEX.data, file = "./DEX_data_estimate_dispersion.Rdata", compress = "xz") plotDispEsts(DEX.data) ## Perform actual DE analysis DEX.data <- testForDEU(DEX.data, BPPARAM = bp.param)
My sessionInfo was:
> sessionInfo() R version 3.2.3 (2015-12-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.1 LTS locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats4 parallel stats graphics grDevices utils datasets [8] methods base other attached packages: [1] DEXSeq_1.16.7 DESeq2_1.10.1 [3] RcppArmadillo_0.6.500.4.0 Rcpp_0.12.3 [5] SummarizedExperiment_1.0.2 GenomicRanges_1.22.3 [7] GenomeInfoDb_1.6.3 IRanges_2.4.6 [9] S4Vectors_0.8.7 Biobase_2.30.0 [11] BiocGenerics_0.16.1 BiocParallel_1.4.3 loaded via a namespace (and not attached): [1] RColorBrewer_1.1-2 futile.logger_1.4.1 plyr_1.8.3 [4] XVector_0.10.0 bitops_1.0-6 tools_3.2.3 [7] futile.options_1.0.0 zlibbioc_1.16.0 biomaRt_2.26.1 [10] statmod_1.4.23 rpart_4.1-10 RSQLite_1.0.0 [13] annotate_1.48.0 gtable_0.1.2 lattice_0.20-33 [16] DBI_0.3.1 gridExtra_2.0.0 stringr_1.0.0 [19] hwriter_1.3.2 genefilter_1.52.1 cluster_2.0.3 [22] Biostrings_2.38.3 locfit_1.5-9.1 grid_3.2.3 [25] nnet_7.3-11 snow_0.4-1 AnnotationDbi_1.32.3 [28] XML_3.98-1.3 survival_2.38-3 foreign_0.8-66 [31] latticeExtra_0.6-26 Formula_1.2-1 magrittr_1.5 [34] geneplotter_1.48.0 ggplot2_2.0.0 lambda.r_1.1.7 [37] Rsamtools_1.22.0 Hmisc_3.17-1 scales_0.3.0 [40] splines_3.2.3 colorspace_1.2-6 xtable_1.8-0 [43] stringi_1.0-1 acepack_1.3-3.3 RCurl_1.95-4.7 [46] munsell_0.4.2
Thanks a lot for your reply; I just realized that my design is slightly different than in the vignette and I guess this causes the error message down the line. I will try and re-run the code.
It indeed turned out to be the design formula; with the formula you suggested things worked fine. Thanks again for your help! Thomas