metacoder
metacoder copied to clipboard
as_phyloseq error
Hi Zachary,
I have built a pipeline with the metacoder tutorials and it was all working fine for a very long time with different data inputs, but recently (2 weeks ago maybe) I am getting an error when changing the taxmap object to phyloseq using as_phyloseq:
Error in UseMethod("as.phyloseq") : no applicable method for 'as.phyloseq' applied to an object of class "c('Taxmap', 'Taxonomy', 'R6')"
if I check my object, it says its Type "environment[68](R6:Taxmap, Taxonomy)" and this happens using different datasets (from previously saved scripts, so I have not changed anything myself).
Do you have any suggestions? I dont know if you may need any of my code or data, but the script is pretty much the same as the tutorial!
Thanks a lot!
By the way, I just tried it using the clean_Data.Rdata from the tutorial and I get the same error. cheers!
Sorry for the delay. I could not reproduce this issue on either the CRAN or Github version. Do you get the same error if you run the example code below? Can you also include your sessionInfo()?
library(metacoder)
#> This is metacoder verison 0.3.5.1 (development version)
library(phyloseq)
#>
#> Attaching package: 'phyloseq'
#> The following object is masked from 'package:metacoder':
#>
#> filter_taxa
data(GlobalPatterns)
x <- parse_phyloseq(GlobalPatterns)
#> The following 17865 of 19216 (93%) input indexes have `NA` in their classifications:
#> 1, 2, 4, 5, 6, 7, 8 ... 19211, 19212, 19213, 19214, 19215, 19216
as_phyloseq(x)
#> phyloseq-class experiment-level object
#> otu_table() OTU Table: [ 19216 taxa and 26 samples ]
#> sample_data() Sample Data: [ 26 samples by 7 sample variables ]
#> tax_table() Taxonomy Table: [ 19216 taxa by 7 taxonomic ranks ]
#> phy_tree() Phylogenetic Tree: [ 19216 tips and 19215 internal nodes ]
Created on 2022-08-16 by the reprex package (v2.0.1)
Hola Zachary,
Thanks a lot for your reply. Running the example code, it runs perfectly fine. Also, since I could do all diversity and ordination analyses without phyloseq, I had left this until now, when I checked again. I don't get the error anymore, I am not totally sure what I've done differently, but its working fine now. Thanks a lot for your support though! And sorry to bother with a non-issue !
No problem, I am glad the issue got resolved.
Hola Zachary,
Just to clarify what happened, a very amateur error, the issue was that a different package has the same function as_phyloseq and because of this I was getting the error. fixed it with simple metacoder::as_phyloseq()
cheers