Retrieves the names of molecules present in the given object, optionally filtered by a specific signature.

getGenes(object, signatures = NULL, simplify = TRUE, ...)

getMetabolites(object, signatures = NULL, simplify = TRUE, ...)

getMolecules(
  object,
  signatures = NULL,
  simplify = TRUE,
  assay_name = activeAssay(object)
)

getProteins(object, signatures = NULL, simplify = TRUE, ...)

Arguments

object

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

signatures

Character vector or NULL. If character, specifies the name of signatures to filter the molecules for.

simplify

Only relevant if signatures is not NULL. If TRUE, all molecule names are merged in to one character vector of unique molecule names. If FALSE, a named list of character vectors is returned (names correspond to signatures).

...

Used to absorb deprecated arguments or functions.

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

A character vector or a named list of character vectors.

Details

These functions retrieve molecule names from the provided object.

  • getMolecules(): The molecules from the assay specified in assay_name.

  • getGenes(): The molecules from the assay with @modality = 'gene' (assay_name = 'gene').

  • getMetabolites(): The molecules from the assay with @modality = 'metabolite' (assay_name = 'metabolite').

  • getProteins(): The molecules from the assay with @modality = 'protein' (assay_name = 'protein').

If 'signature' is NULL, it returns all molecules from the respective assay in the object.

Note

Molecule names are picked from the raw count matrix the assay.

See also

getMatrix(), getSignatures()

Examples


library(SPATA2)
object <- loadExampleObject("UKF313T")

getAssayNames(object)

## no subsetting by signatures
# opt 1
genes <- getMolecules(object)

str(genes)

# opt 2
genes <- getMolecules(object, assay_name = "gene")

str(genes)

# opt 3
genes <- getGenes(object)

# opt 4 - fails cause no 'protein' assay

proteins <- getProteins(object)

## using signatures argument
# character vector of molecules of specific signatures (simplify defaults to TRUE)
genes_hyp <- getGenes(object, signatures = "HM_HYPOXIA")

genes_hyp

# list of gene sets
tcr_gs <- c("RCTM_TCR_SIGNALING", "RCTM_DOWNSTREAM_SIGNALING")

# simplify = TRUE (default) merges the output to a character vector of unique names
tcr_genes_vec <- getGenes(object, signatures = tcr_gs, simplify = TRUE)

str(tcr_genes_vec)

# simplify = FALSE returns a list
tcr_genes_lst <- getGenes(object, signatures = tcr_gs, simplify = FALSE)

str(tcr_genes_lst)

## DEPRECATED: of_gene_sets
tcr_genes <- getGenes(object, of_gene_sets = tcr_gs, simplify = FALSE)