loom: A class for connections loom files

Description Usage Format Fields Methods See Also

Description

A class for connections loom files

Usage

1
lfile <- loomR::connect(filename = 'myfile.loom')

Format

An R6::R6Class object

Fields

version

Version of loomR object was created under

shape

Shape of /matrix in genes (columns) by cells (rows)

chunksize

Chunks set for this dataset in columns (cells) by rows (genes)

matrix

The main data matrix, stored as columns (cells) by rows (genes)

layers

Additional data matricies, the same shape as /matrix

col.attrs

Extra information about cells

row.attrs

Extra information about genes

Methods

add.graph(a, b, w, name, MARGIN, overwrite), add.graph.matrix(mat, name, MARGIN, overwrite)

Add a graph to the loom object; can add either in coorindate format (add.graph) or matrix format (add.graph.matrix). Stores graph in coordinate format as [row, col]_graphs/name/a (row indices), [row, col]_graphs/name/b (column indices), and [row, col]_graphs/name/w (values)

a

Integer vector of row indices for graph, must be the same lengths as b and w

b

Integer vector of column indices for graph, must be the same lengths as a and w

w

Numeric vector of values for graph, must be the same lengths as a and b

mat

Graph provided as a matrix (sparse or dense) or data.frame

name

Name to store graph, will end up being col_graphs/name or row_graphs/name, depending on MARGIN

MARGIN

Store the graph in row_graphs (1) or col_graphs (2), defaults to 2

overwrite

Can overwrite existing graph?

add.layer(layer, chunk.size, overwrite)

Add a data layer to this loom file, must be the same dimensions as /matrix

layer

A named list of matrices to be added as layers

chunk.size

Number of rows from each layer to stream at once, defaults to 1000

overwrite

If a layer already exists, overwrite with new data, defaults to FALSE

add.attribute(attribute, MARGIN, overwrite)

Add extra information to this loom file.

attribute

A named list where the first dimmension of each element as long as one dimension of /matrix

MARGIN

Either 1 for genes or 2 for cells

overwrite

Can overwrite existing attributes?

add.row.attribute(attribute), add.col.attribute(attribute)

Add row or column attributes

get.attribute.df(MARGIN, attribute.names, row.names, col.names)

Get a group of row or column attributes as a data frame, will only return attributes that have one dimension

MARGIN

Either '1' or '2' to get row- or column-attributes, respectively

attribute.names

A vector of attribute dataset basenames

row.names

Basename of the rownames dataset

col.names

Basename of the colnames dataset

get.graph(name, MARGIN)

Get a graph as a sparse matrix

name

Name of the graph, can be either the basename or full name of the grpah

MARGIN

Load the graph from row_graphs (1) or col_graphs (2), defaults to 2. Ignored if full path to graph is passed to name

batch.scan(chunk.size, MARGIN, index.use, dataset.use, force.reset), batch.next(return.data)

Scan a dataset in the loom file from index.use[1] to index.use[2], iterating by chunk.size.

chunk.size

Size to chunk MARGIN by, defaults to self$chunksize

MARGIN

Iterate over genes (1) or cells (2), defaults to 2

index.use

Which specific values of dataset.use to use, defaults to 1:self$shape[MARGIN] (all values)

dataset.use

Name of dataset to use, can be the name, not group/name, unless the name is present in multiple groups

force.reset

Force a reset of the internal iterator

return.data

Return data for a given chunk, if FALSE, returns the indices across MARGIN for said chunk

apply(name, FUN, MARGIN, chunk.size, dataset.use, overwrite, display.progress, ...)

Apply a function over a dataset within the loom file, stores the results in the loom file. Will not make multidimensional attributes.

name

Full name ('group/name') of dataset to store results to

FUN

Function to apply

MARGIN

Iterate over genes (1) or cells (2), defaults to 2

index.use

Which specific values of dataset.use to use, defaults to 1:self$shape[MARGIN] (all values)

chunk.size

Size to chunk MARGIN by, defaults to self$chunksize

dataset.use

Name of dataset to use

overwrite

Overite name if already exists

display.progress

Display progress

...

Extra parameters to pass to FUN

map(FUN, MARGIN, chunk.size, index.use, dataset.use, display.progress, expected, ...)

Map a function onto a dataset within the loom file, returns the result into R.

FUN
MARGIN

Iterate over genes (1) or cells (2), defaults to 2

chunk.size

Size to chunk MARGIN by, defaults to self$chunksize

index.use

Which specific values of dataset.use to use, defaults to 1:self$shape[MARGIN] (all values)

dataset.use

Name of dataset to use

display.progress

Display progress

...

Extra parameters to pass to FUN

add.cells(matrix.data, attributes.data = NULL, layers.data = NULL, display.progress = TRUE)

Add cells to a loom file.

matrix.data

A list of m2 cells where each entry is a vector of length n (num genes, self$shape[1])

attributes.data

A list where each entry is named for one of the datasets in self[['col_attrs']]; each entry is a vector of length m2.

layers.data

A list where each entry is named for one of the datasets in self[['layers']]; each entry is an n-by-m2 matrix where n is the number of genes in this loom file and m2 is the number of cells being added.

display.progress

Display progress

add.loom(other, other.key, self.key, ...)

Add the contents of another loom file to this one.

other

An object of class loom or a filename of another loom file

other.key

Row attribute in other to add by

self.key

Row attribute in this loom file to add by

...

Ignored for now

See Also

loomR, hdf5r::H5File


mojaveazure/loomR documentation built on May 29, 2019, 5:44 a.m.