BIOMdimensions: Row and column information of BIOM data

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Report shape, unique row and column ids, and row and column metadata annotations of an object of class biom.

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'biom'
dim(x)

## S3 method for class 'biom'
dimnames(x)

metadata(x, ...)
## S3 method for class 'biom'
metadata(x, ...)

Arguments

x

an object (biom)

...

unused

Details

BIOM (Biological Observation Matrix) is a simple prescription for storing an annotated table of data. It may be described as a format, standard, or data structure.

The JSON (JavaScript Object Notation) standard for expressing general data objects as text is employed to define BIOM. Therefore the native form of BIOM data is structured text, conforming to the JSON specification in general and the BIOM specification in particular. Familiarity with BIOM is assumed here.

The S3 class biom and its methods facilitate analyses by expressing BIOM data as objects in the R environment. The functions above apply to an R object that is already of class biom.

dim() returns the dimensions of the BIOM data table (its shape).

dimnames() returns the unique row and column ids required by BIOM.

metadata() returns the row and column metadata annotations provided for by BIOM. They may be empty.

Value

For dim(), a length-two integer vector, with additional attribute "nnz" (number not zero) if the object is "sparse", equaling the number of values (rows) in the sparse representation. See note below.

For dimnames(), a list of two character vectors, named "rows" and "columns".

For metadata(), a list (invisibly) of two components, named "rows" and "columns". Each is a list equal in length to the data table's corresponding dimension.

Note

When x is "sparse" the dimensions of as.matrix(x) are not given by dim(x). Rather, the latter has dimensions c("nnz", 3). See above.

Also note that BIOM requires no exact structure for the metadata annotations of each row (column). All that is guaranteed is a list (possibly of empty, atomic, or nested list elements) with as many entries as the data table has rows (columns).

Author(s)

Daniel T. Braithwaite

References

BIOM format
JSON

See Also

biom, as.matrix.biom

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
##  one toy example, one real example:
dd <- biom (dmat, quiet=TRUE)
ff <- biom (li4, quiet=TRUE)

dim (dd)
dim (ff)
dim (as.matrix (ff))
dim (as.matrix (ff, expand=TRUE))

dimnames (dd)
dimnames (ff)

##  automatic row and column ids:
dimnames (biom (smat, sparse=TRUE, quiet=TRUE))

##  no metadata:
print (metadata (dd))

##  simple metadata:
ss <- biom (li3)
print (as.matrix (ss))
metadata (ss) $ columns

##  complicated metadata, so look only at part:
head (metadata(ff) $ rows)
str (metadata(ff) $ columns [[1]])

BIOM.utils documentation built on May 1, 2019, 7:32 p.m.