joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
567 stars 187 forks source link

import_biom: HDF5 format warnings #1692

Open biobee opened 11 months ago

biobee commented 11 months ago

Dear all,

In the past importing an HDF5 biom file would give a warning ("input string 1"...). This was not the case with a later phyloseq version (e.g. 1.42.0). However, now these warnings appear again (1.44.0). What exactly is causing this? Is it related to phyloseq itself or a R versions? The imported biom looks OK. To avoid the warnings, I converted to JSON in the past, but it would be great it these warnings were not thrown.

Using: R version 4.3.0 (2023-04-21 ucrt) Bioconductor 3.17 phyloseq_1.44.0

import_biom("test.biom") #in HDF5 format phyloseq-class experiment-level object otu_table() OTU Table: [ 467 taxa and 27 samples ] tax_table() Taxonomy Table: [ 467 taxa by 7 taxonomic ranks ]

Warning messages: 1: In strsplit(conditionMessage(e), "\n") : unable to translate 'lexical error: invalid char in json text.

<89>HDF (right here) ------^ ' to a wide string 2: In strsplit(conditionMessage(e), "\n") : input string 1 is invalid Using: R version 4.2.2 (2022-10-31 ucrt) phyloseq_1.42.0 (Bioconductor 3.16) Import is successful and no warnings are given
RustTurakulov commented 7 months ago

I have got similar warning in Windows

biom1 <- import_biom("silva_feature-table-batch001.biom") Warning messages: 1: In strsplit(conditionMessage(e), "\n") : unable to translate 'lexical error: invalid char in json text.

<89>HDF  (right here) ------^ ' to a wide string 2: In strsplit(conditionMessage(e), "\n") : input string 1 is invalid 3: In asMethod(object) : sparse->dense coercion: allocating vector of size 2.0 GiB Interestingly in another package library("biomformat"); Got exact same message above. R version 4.3.1 (2023-06-16 ucrt) phyloseq_1.44.0 biomformat_1.28.0
heathermacgregor commented 2 months ago

I am having the same issue:

`> library(biomformat)

feature_table_path_biom <- "/usr2/people/macgregor/MTV/Amplicon/Analysis/2024-04-11/cluster-dn-97/table/feature-table.biom" x <- read_biom(feature_table_path_biom) Warning messages: 1: In strsplit(conditionMessage(e), "\n") : unable to translate 'lexical error: invalid char in json text.

<89>HDF (right here) ------^ ' to a wide string 2: In strsplit(conditionMessage(e), "\n") : input string 1 is invalid`
svillegasv commented 2 months ago

I was experiencing the same problem. What seemed to work was to convert the .biom from hdf5 to json in the command line using:

biom convert -i input_hdf5_file.biom -o output_json_file.biom --to-json

Later, I was able to load the resulting biom file into R using the read_biom2phyloseq function from the microbiome package and add the metadata as an argument in the same function.

Hope it helps.