0
18 months ago by
channen12210 wrote:

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

phyloseq R biomformat • 971 views
modified 18 months ago by Axel Klenk920 • written 18 months ago by channen12210
0
18 months ago by
Axel Klenk920
Switzerland
Axel Klenk920 wrote:

Hi Channen1221,

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

Attaching the output of

sessionInfo()

is also a good idea.

Cheers,

- axel

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"

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

then I got this message

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.

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.

Thanks Axel,

I tried, but again I got the same message

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

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

biom_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.

:(

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 ?

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,

1

HI Martin,

I tried this

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

and it's works!!!!

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