Skip to contents

This is the main function to access slot data for all genes as a sparse matrix.

Usage

GetSparseMatrix(
  data,
  mode.slot = DefaultSlot(data),
  columns = NULL,
  genes = Genes(data),
  name.by = "Symbol"
)

Arguments

data

A grandR object

mode.slot

Which kind of data to access (see details)

columns

which columns (i.e. samples or cells) to return (see details)

genes

Restrict the output table to the given genes

name.by

A column name of Coldata(data). This is used as the rownames of the output table

Value

A sparse matrix containing the desired values

Details

To refer to data slots, the mode.slot syntax can be used: It is either a data slot, or one of (new,old,total) followed by a dot followed by a slot. For new or old, the data slot value is multiplied by ntr or 1-ntr. This can be used e.g. to obtain the new counts.

Columns can be given as a logical, integer or character vector representing a selection of the columns (samples or cells). The expression is evaluated in an environment havin the Coldata, i.e. you can use names of Coldata as variables to conveniently build a logical vector (e.g., columns=Condition=="x").