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
Import MG-RAST biom-file using biom and phyloseq #272
Comments
Can you provide example dadta and code so I can reproduce this? |
I send you an email with the file. |
I will take a look and let you know. Thanks for sending the file... |
MG-RAST did not include a For your specific case I was able to make a workaround (shown at the bottom) in a few lines of code using both the biom and phyloseq packages. The details of diagnosing the error are shown immediately below, as well as a separate double-entry error in your data that you should make sure to address as well (but has nothing to do with phyloseq or biom). Diagnosing problemlibrary("phyloseq")
data = import_biom("~/Downloads/KO.biom", parseFunction = parse_taxonomy_greengenes)
Check what the warnings are warnings()
library("biom")
read_biom("~/Downloads/KO.biom")
Let's explore further, attempt to extract the abundance table as x = read_biom("~/Downloads/KO.biom")
head(biom_data(x))
It looks as though there is something wrong with the sparse indexing of the file. The file has duplicate entries for the same pair of indices. This was one of the The source of the error is that this parseFunction = parse_taxonomy_greengenes
mgrast_error = lapply(x$rows, function(i){parseFunction(i$metadata$taxonomy)})
warnings()
head(mgrast_error, 3)
As you can see, they are all empty, and that is because there is no It's not absolutely essential that phyloseq see a Solution: Manually coerce the two tables into phyloseq objectsYou can use tools in the biom-package to convert the observation/feature metadata into a separate library("phyloseq")
library("biom")
x = read_biom("~/Downloads/KO.biom")
otumat = as(biom_data(x), "matrix")
OTU = otu_table(otumat, taxa_are_rows=TRUE)
taxmat = as.matrix(observation_metadata(x), rownames.force=TRUE)
TAX = tax_table(taxmat)
physeq = phyloseq(OTU, TAX)
ggsave("issue-272.png", plot_ordination(physeq, ordinate(physeq)) + geom_point(size=6)) |
Hi Joey!
BUT here the problems start This command produces a List with one column only: so therefore the command
Error in fread(input = paste0(x, collapse = "\n"), sep = "\t", header = TRUE, : 3: running command 'C:\Windows\system32\cmd.exe /c ({"id": "None","format": "Biological Observation Matrix 1.0.0","format_url": "http://biom-format.org","type": "OTU table","generated_by": "QIIME 1.7.0-dev","date": "2014-10-09T16:21:41.267897","matrix_type": "sparse","matrix_element_type": "int","shape": [1149, 1504],"data":Any ideas? |
With MG-RAST I generate a biom file (QIIME data file and QIIME metadata file). I tried to load that into R to use with phyloseq but I got an error. Is there a command line for this?
The text was updated successfully, but these errors were encountered: