Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘assayData’ for signature ‘"fitZigResults"’ #79

Open
DitteOL opened this issue Jun 10, 2020 · 9 comments
Assignees
Labels

Comments

@DitteOL
Copy link

DitteOL commented Jun 10, 2020

Hi,

I have a problem when comparing two levels in a given Rank using metagenomeseq. This have worked for me not long ago and now I only receive errors:

I use the function (model being the variable in which I want to compare the two levels):

metagenomeSeq_treatment_on_any_level_eff_Model = function(physeq,level) {
  require("metagenomeSeq")
  require("phyloseq")
  # Enforce orientation
  if (!taxa_are_rows(physeq)) {
    physeq <- t(physeq)
  }
  
o = as(otu_table(physeq), "matrix")
s<-as(data.frame(sample_data(physeq)), "AnnotatedDataFrame")# Convert sample_data to AnnotatedDataFrame
t<-as(data.frame(tax_table(physeq)), "AnnotatedDataFrame")# Convert tax_data to AnnotatedDataFrame
mr = newMRexperiment(o,phenoData=s,featureData=t)  # Create the metagenomeSeq object

mr_agg<-aggregateByTaxonomy(mr,lvl=level,norm=T,aggfun=colSums, log=F, sl=1000, out ="MRexperiment")
mr_agg<-cumNorm(mr_agg)  # Trigger metagenomeSeq to calculate its Cumulative Sum scaling factor.
treatm<-pData(mr_agg)$Model
mod = model.matrix(~treatm)
colnames(mod) = levels(treatm)
settings = zigControl(maxit=100,verbose=FALSE)
fit = fitZig(obj = mr_agg, mod=mod, control=settings)

a = MRfulltable(fit, number = nrow(assayData(fit)$counts), eff = .5)
b <- subset(a, adjPvalues<=0.05)

return(b)
}

I use a phyloseq object

phyloseq-class experiment-level object
otu_table() OTU Table: [ 1254 taxa and 12 samples ]
sample_data() Sample Data: [ 12 samples by 5 sample variables ]
tax_table() Taxonomy Table: [ 1254 taxa by 7 taxonomic ranks ]
phy_tree() Phylogenetic Tree: [ 1254 tips and 1253 internal nodes ]

in the function:

sig_lvl2_eff_NASH = metagenomeSeq_treatment_on_any_level_eff_Model(Ellegaard,"Rank2")

And gets this error code with debug:

Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘assayData’ for signature ‘"fitZigResults"’
6. stop(gettextf("unable to find an inherited method for function %s for signature %s",
sQuote(fdef@generic), sQuote(cnames)), domain = NA)
5. (function (classes, fdef, mtable) {
methods <- .findInheritedMethods(classes, fdef, mtable)
if (length(methods) == 1L) ...
4. assayData(fit)
3. nrow(assayData(fit)$counts)
2. MRfulltable(fit, number = nrow(assayData(fit)$counts), eff = 0.5)

  1. metagenomeSeq_treatment_on_any_level_eff_Model(Ellegaard, "Rank2")
sessionInfo()

R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats4 grid parallel stats graphics grDevices utils datasets
[9] methods base

other attached packages:
DESeq2_1.28.1
SummarizedExperiment_1.18.1
DelayedArray_0.14.0
matrixStats_0.56.0
GenomicRanges_1.40.0
GenomeInfoDb_1.24.0
IRanges_2.22.2
S4Vectors_0.26.1
pheatmap_1.0.12
gtable_0.3.0
extrafont_0.17
extrafontdb_1.0
MASS_7.3-51.6
reshape2_1.4.4
gmodels_2.18.1
gtools_3.8.2
gplots_3.0.3
metagenomeSeq_1.30.0
[19] RColorBrewer_1.1-2
glmnet_4.0
Matrix_1.2-18
limma_3.44.1
Biobase_2.48.0
BiocGenerics_0.34.0
doParallel_1.0.15
iterators_1.0.12
foreach_1.5.0
vegan_2.5-6
lattice_0.20-41
permute_0.9-5
knitr_1.28
plyr_1.8.6
ggplot2_3.3.1
phyloseq_1.32.0

loaded via a namespace (and not attached):
[1] nlme_3.1-148 bitops_1.0-6 bit64_0.9-7
[4] tools_4.0.0 R6_2.4.1 KernSmooth_2.23-17
[7] DBI_1.1.0 mgcv_1.8-31 colorspace_1.4-1
[10] ade4_1.7-15 withr_2.2.0 tidyselect_1.1.0
[13] bit_1.1-15.2 compiler_4.0.0 labeling_0.3
[16] caTools_1.18.0 scales_1.1.1 genefilter_1.70.0
[19] digest_0.6.25 stringr_1.4.0 XVector_0.28.0
[22] pkgconfig_2.0.3 rlang_0.4.6 rstudioapi_0.11
[25] RSQLite_2.2.0 farver_2.0.3 shape_1.4.4
[28] generics_0.0.2 jsonlite_1.6.1 BiocParallel_1.22.0
[31] dplyr_1.0.0 RCurl_1.98-1.2 magrittr_1.5
[34] GenomeInfoDbData_1.2.3 biomformat_1.16.0 Rcpp_1.0.4.6
[37] munsell_0.5.0 Rhdf5lib_1.10.0 ape_5.4
[40] lifecycle_0.2.0 stringi_1.4.6 zlibbioc_1.34.0
[43] rhdf5_2.32.0 blob_1.2.1 gdata_2.18.0
[46] crayon_1.3.4 Biostrings_2.56.0 splines_4.0.0
[49] multtest_2.44.0 annotate_1.66.0 locfit_1.5-9.4
[52] pillar_1.4.4 igraph_1.2.5 Wrench_1.6.0
[55] geneplotter_1.66.0 codetools_0.2-16 XML_3.99-0.3
[58] glue_1.4.1 BiocManager_1.30.10 data.table_1.12.8
[61] vctrs_0.3.1 Rttf2pt1_1.3.8 purrr_0.3.4
[64] xfun_0.14 xtable_1.8-4 survival_3.1-12
[67] tibble_3.0.1 AnnotationDbi_1.50.0 memoise_1.1.0
[70] cluster_2.1.0 ellipsis_0.3.1

Thank you for the much needed help!

@hcorrada
Copy link
Contributor

We made a change to the representation of results (that’s what fitZigResults is). I’ll take a look to check if we missed an update to the MRfulltable method.

@hcorrada hcorrada added the bug label Jun 10, 2020
@hcorrada hcorrada self-assigned this Jun 10, 2020
@DitteOL
Copy link
Author

DitteOL commented Jul 2, 2020

Dear hcorrada
I was wandering if there was any progress on this issue?
Thank in advance!

@dombraccia
Copy link
Contributor

Hi @DitteOL , I’m looking into the problem. Would you mind sending me a subset of the phyloseq dataset you are working with? It would help me create a reproducible example. You can send it to [email protected]

@dombraccia
Copy link
Contributor

@DitteOL could you update your version of metagenomeSeq to the most current? It seems you are running on version 1.30 and the most current version is 1.31.

@DitteOL
Copy link
Author

DitteOL commented Jul 6, 2020

I have tried this several times but I'm not allowed to go higher than v 1.30.

Thank you for your prompt response!

@dombraccia
Copy link
Contributor

dombraccia commented Jul 10, 2020

@DitteOL If you haven't already, could you try installing metagenomeSeq via: BiocManager::install("hcbravolab/metagenomeSeq") and then check the version to see if it updates?

@DitteOL
Copy link
Author

DitteOL commented Jul 13, 2020

Now I'm allowed to update matagenomeSeq. But I still get the same error when trying to compare two levels:

Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘assayData’ for signature ‘"fitZigResults"’

Any other ideas? :)

@DitteOL
Copy link
Author

DitteOL commented Jul 27, 2020

@dombraccia After updating several times and are now at RStudio version 1.3.1056 and R version 4.0.2 (macOS Catalina) plus supplementing my code with:

no_cores <- detectCores() - 1
library(doParallel)

create the cluster for caret to use

#cl <- makePSOCKcluster(no_cores)
cl <- parallel::makeCluster(no_cores, setup_strategy = "sequential")
registerDoParallel(cl)

I get this error message:

Error in h(simpleError(msg, call)) :
error in evaluating the argument 'x' in selecting a method for function 'nrow': unable to find an inherited method for function ‘assayData’ for signature ‘"fitZigResults"’

I was wondering if I'm back to the start or the problem have changed?

Again your help is much appreciated!

@dombraccia
Copy link
Contributor

Hey @DitteOL,

It appears that you are still running into the same problem, since there is not a specific assayData generic method built in for the fitZigResults class. What I need to do on my end is test out an assayData method on this results class and that will likely solve all your problems.

However, I am curious about the latest code you have sent. I assume the doParallel code does not interfere with the metagenomeSeq_treatment_on_any_level_eff_Model function you have specified above? If not, then I will continue using the data you have sent me over email and the code above to try and debug the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants