Closed jayelldubya closed 9 months ago
Thanks for pointing that out! I see where the bug is and will push a fix shortly. Until then, this function will do the trick:
phy2biom <- function (phy) {
rbiom$new(
counts = phy %>% phyloseq::otu_table() %>% slam::as.simple_triplet_matrix(),
metadata = phy %>% phyloseq::sample_data(errorIfNULL = FALSE) %>% data.frame(),
taxonomy = phy %>% phyloseq::tax_table(errorIfNULL = FALSE) %>% data.frame(),
sequences = phy %>% phyloseq::refseq(errorIfNULL = FALSE) %>% as.vector(),
tree = phy %>% phyloseq::phy_tree(errorIfNULL = FALSE),
id = "Imported PhyloSeq Data" )
}
Thank you so much for your prompt reply! I tried using the above function but am still running into issues. I ran the following:
phy2biom <- function (phy) {
rbiom$new(
counts = phy %>% phyloseq::otu_table() %>% slam::as.simple_triplet_matrix(),
metadata = phy %>% phyloseq::sample_data(errorIfNULL = FALSE) %>% data.frame(),
taxonomy = phy %>% phyloseq::tax_table(errorIfNULL = FALSE) %>% data.frame(),
sequences = phy %>% phyloseq::refseq(errorIfNULL = FALSE) %>% as.vector(),
tree = phy %>% phyloseq::phy_tree(errorIfNULL = FALSE),
id = "Imported PhyloSeq Data" )
}
The above resulted in no warnings, but when I tried the below I received an error "Error in phy2biom(CombPhyNumFiltered) : object 'rbiom' not found"
test = phy2biom(phyloseqObject)
Did I misunderstand how to use the function you provided? I tried a few other iterations as well but did not have any success.
Oh, oops.. forgot that was a private object. I just pushed the fix to this repo, along with lots of other improvements. as_rbiom()
should work as expected now in version 2.0.0.9114.
It's working now! A huge thanks again for your help :)
Hi there,
I'm trying to import my data from a phyloseq object, but am running into problems using the 'as_rbiom', in that it does not appear to work with a phyloseq object. I receive the error:
Everything is installed properly as I was able to replicate your vignette, and further, I am able to extract the OTU table as a matrix from the same phyloseq object that does not produce any errors or warnings. E.g.
Apologies if I somehow missed this, but I looked through your tutorial on github as well as the R documentation and was not able to find information that could help me troubleshoot this. Thanks in advance