Creates and adds an object of class MolecularAssay to the SPATA2 object.

createMolecularAssay(
  object,
  modality,
  mtr_counts = Matrix::Matrix(),
  mtr_proc = list(),
  active_mtr = NULL,
  overwrite = FALSE,
  activate = FALSE,
  verbose = NULL,
  ...
)

Arguments

object

An object of class SPATA2 or, in case of S4 generics, objects of classes for which a method has been defined.

modality

Character value. Should best describe the molecular type of the count matrix. Additionally, it defines the assay name, that is created with the count matrix and further referred to via the argument assay_name. Read more on molecular modalities in SPATA2 here.

mtr_counts

A count matrix. Column names correspond to the barcodes of the observations. Rownames correspond to the names of the molecular features (genes, proteins, metabolites etc.).

mtr_proc

A list of processed matrices set in slot @mtr_proc.

active_mtr

Character value. The name of the matrix chosen as the active matrix. If mtr_proc is an empty list, this value defaults to 'counts'

overwrite

Logical value. Must be TRUE to allow overwriting.

verbose

Logical. If TRUE, informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

...

Gives access to set remaining slots of the MolecularAssay object.

Value

The updated input object, containing the added, removed or computed results.

Details

Creating an assay only with processed matrices (mtr_proc) while not specifying mtr_counts is possible. In that case, mtr_counts is populated with an empty matrix that contains all unique molecule names found in the matrices as rownames and barcodes as colnames.

Generally speaking, the count matrix contains all molecule names! Processed matrices contain either identical molecule names or a subset of those found in the count matrix.

Note

The molecules of the added assay must not already exist in the SPATA2 object. Variables in SPATA2 are case sensitive! If you want to add, for instance, a protein assay to the SPATA2 object that already contains genes, you can provide the protein names like this Ldh while the gene names exist like this LDH. See stringr::str_to_title() and related functions.