Cannot read Biom file
1
0
Entering edit mode
@channen1221-14311
Last seen 4.1 years ago

Hi there

I am terrible in R - its my worst nightmare. And i only post this because I am desperate. 

I have a .biom file (json version; format: Biological Observation Matrix 1.0.0). However when trying to import to RStudio I get an error message:

Error in read_biom(biom_file = BIOMfilename) : 
  Both attempts to read input file:

either as JSON (BIOM-v1) or HDF5 (BIOM-v2).
Check file path, file name, file itself, then try again.

I'm not entirely certain what I need to change or if i'm not using the correct packages. 

 

Thanks

r biomformat phyloseq • 3.0k views
ADD COMMENT
0
Entering edit mode
Axel Klenk ▴ 980
@axel-klenk-3224
Last seen 15 hours ago
Switzerland

Hi Channen1221,

we need a little bit of information to help you.

First of all, please show us the command(s) you have entered.

Attaching the output of

sessionInfo()

is also a good idea.

Cheers,

 - axel

ADD COMMENT
0
Entering edit mode

Hi  all,

I have the same error. 

I have my otu_table.biom constructed by Qiime 1.9 and my metadata file and I tried to import in Phyloseq and until now I have not couldn't; I changed my otu_table.biom to json with this command

biom convert -i otu_table.biom -o otu_table_json.biom --table-type="OTU table" --to-json

However, with this file, I have not couldn't,

jsonbiomfile = "C/Users/metagenomic/Desktop/otu_table_json.biom"
jsonbiomfile = "C/Users/metagenomic/Desktop/metadata_ITS.txt"

biom_file <- paste(jsonbiomfile, "otu_table_json.biom", sep = "")
map_file <- paste(jsonbiomfile, "metadata_ITS.txt", sep = "")

read_biom(biom_file)

then I got this message

Error in read_biom(biom_file) : Both attempts to read input file:
C/Users/metagenomic/Desktop,otu_table_json.biom
either as JSON (BIOM-v1) or HDF5 (BIOM-v2).
Check file path, file name, file itself, then try again.

 

Please if you have any advice, I appreciate that, thanks in advance

 

 

ADD REPLY
0
Entering edit mode

Dear voteroj,

without looking at the read_biom() code, I guess it is trying to tell you that there is a problem with your

filename.  These look like Windows paths and I'd suggest to simply add a colon to the drive letter, as in

jsonbiomfile = "C:/Users/metagenomic/Desktop/otu_table_json.biom"

(untested, I'm on linux)

Hope this helps.

 

ADD REPLY
0
Entering edit mode

Thanks Axel, 

I tried, but again I got the same message 

jsonbiomfile = "C:/Users/metagenomic/Desktop"
jsonbiomfi = "C:/Users/metagenomic/Desktop/metadata_ITS.txt"

biom_file <- paste(jsonbiomfile, "otu_table_json.biom", sep = "")
map_file <- paste(jsonbiomfi, "metadata_ITS.txt", sep = "")

biom_file
read_biom(biom_file)

Error in read_biom(biom_file) : Both attempts to read input file:
C:/Users/metagenomic/Desktopotu_table_json.biom
either as JSON (BIOM-v1) or HDF5 (BIOM-v2).
Check file path, file name, file itself, then try again.

:(

 

ADD REPLY
0
Entering edit mode

use file.path() instead of paste(), or biom_file <- file.choose() ; but instead of typing stuff and hoping that it works, check that it makes sense, for instance, do you actually have a file at C/Users/metagenomic/Desktop,otu_table_json.biom ?

ADD REPLY
0
Entering edit mode

 Hi Martin, Thanks for your answer, 

I tested your recommendation and the error is the same.

and well after I reviewed some post in github, and I red  phyloseq manual for import .biom table, I have couldn't  understand what is the problem, I have my file in the desktop as you see in the first part of my script 

jsonbiomfile = "C:/Users/metagenomic/Desktop"

But then it appears  

C:/Users/metagenomic/Desktopotu_table_json.biom

I don't know why; please if you have another text or place to visit please don't hesitate to tell me, I want to learn and is my first time,

Thanks in advance,

 

 

ADD REPLY
1
Entering edit mode

HI Martin,

I tried this

#####Input .biom
jsonbiomfile = "C:/Users/metagenomic/Desktop/otu_table_json.biom"
read_biom(jsonbiomfile)
x = read_biom(jsonbiomfile)
header(x)
biom_shape(x)
nrow(x)
ncol(x)
rownames(x)
colnames(x)
matrix_element_type(x)
biom_data(x)

and it's works!!!!

 

ADD REPLY
0
Entering edit mode

Ouch, apologies for providing misleading help by posting a quick reply when I was about to leave my office... I had completely overlooked your paste() call...

In your call to paste(), you're explicitly asking for no (empty) separator between file path and filename by setting argument sep = "". It would have worked if you had used sep = "/" (and "C:").

?paste

However, as Martin has told you, it is much better to use file.path() instead of paste() because it will pick the right path separator for your OS by default.

?file.path

 

ADD REPLY

Login before adding your answer.

Traffic: 430 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6