Adds a molecular signature to the SPATA2 object.

addGeneSet(object, genes, name, class = "UD", overwrite = FALSE, check = TRUE)

addMetaboliteSet(
  object,
  metabolites,
  name,
  class = "UD",
  overwrite = FALSE,
  check = TRUE
)

addProteinSet(
  object,
  proteins,
  name,
  class = "UD",
  overwrite = FALSE,
  check = TRUE
)

addSignature(
  object,
  molecules,
  name,
  class = "UD",
  assay_name = activeAssay(object),
  overwrite = FALSE,
  check = TRUE
)

Arguments

object

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

name

Character value. The actual name of the signature.

class

Character value. The class (heritage) of the signature. Must not contain a _. Defaults to 'UD', short for user defined.

overwrite

Logical value. Must be TRUE to allow overwriting.

check

Logical value. If TRUE, the functions checkes whether the specified molecules exist in the raw count matrix of the assay and throw an error if some are not. Defaults to TRUE.

molecules, genes, proteins, metabolites

Character vector. The molecules the signature consists of.

assay_name

Only relevant if the SPATA2 object contains more than one assay: Denotes the assay of interest and thus the molecular modality to use. Defaults to the active assay as set by activateAssay().

Value

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

Details

These functions allow to add molecular signatures to the provided object.

  • addSignature(): Adds a signature to the assay specified in assay_name.

  • addGeneSet(): Adds a signature to the assay with @modality = 'gene' (assay_name = 'gene').

  • addMetaboliteSet(): Adds a signature to the assay with @modality = 'metabolite' (assay_name = 'metabolite').

  • addProteinSet(): Adds a signature to the assay with @modality = 'protein' (assay_name = 'protein').

Examples


library(SPATA2)

data("example_data")
object <- example_data$object_UKF269T_diet

# example genes of an hypothetical gene signature (gene set)
genes <-
 c('CYFIP1', 'SLC16A3', 'AKAP5', 'ADCY8', 'CALB2', 'GRIN1', 'NLGN4X', 'NLGN1',
   'ITGA3', 'NLGN4Y', 'ELFN1', 'BSN', 'CNTN6', 'PDE4B', 'DGKI', 'LRRTM2', 'LRRTM1',
   'SRPX2', 'SHANK1', 'SLC17A7')

# both, opt1 and opt2, have the same effect (addSignature() just allows to specify the
# assay of interest, which is fixed to 'gene' for addGeneSet()).
# opt1
object <- addSignature(object, name = "EXCITATORY_SYNAPSE", class = "Custom", molecules = genes)

# opt2
# object <- addGeneSet(object, name = "EXCITATORY_SYNAPSE", class = "Custom", genes = genes)

gs <- "Custom_EXCITATORY_SYNAPSE"

# visualize signature expression
plotSurface(object, color_by = gs)

# extract genes of signature
getGenes(object, signatures = gs)