cmmr / rbiom

Interact with Biological Observation Matrix files.
https://cmmr.github.io/rbiom/
Other
11 stars 0 forks source link

XLSX output neglects metadata #7

Closed chrysn closed 1 year ago

chrysn commented 1 year ago

The metadata loaded from a BIOM file is not output in the XLSX data, even though it would be useful to have, eg. in a dedicated sheet.

To reproduce, start with the test.biom file from https://github.com/cmmr/rbiom/issues/6, and prepare two extra files:

sample.tsv:

#Sample foo
sample1 f1
sample2 f2

observation.tsv:

#OTU ID bar
obs1    b1
obs2    b2

and run:

$ biom add-metadata -i test.biom -o test2.biom --sample-metadata-fp sample.tsv --observation-metadata-fp observation.tsv

Now we have a test2.biom file with metadata, and can run

> library('rbiom')
> b <- read.biom('test2.biom', tree=FALSE)
> b$metadata
> b$taxonomy[1,] = c("a") # see #6
> write.xlsx(b, 'test2.xlsx')

but the metadata shown after b$metadata is not part of the XLSX output. And the observation metadata is not even read, it appears -- should I open a dedicated issue for that, or can this be tracked in here as well?

Please consider adding metadata output to the XLSX outputs.

dansmith01 commented 1 year ago

Good idea, metadata is now included in xlsx exports.