Get the genes and sample (or cell) names for a grandR object, or add an additional gene annotation column
Usage
Genes(data, genes = NULL, use.symbols = TRUE, regex = FALSE)
Columns(data, columns = NULL, reorder = FALSE)
Arguments
- data
A grandR object
- genes
which genes to use
- use.symbols
obtain the gene symbols instead of gene names
- regex
treat genes as a regex, and return all that match
- columns
which columns (i.e. samples or cells) to return (see details)
- reorder
if TRUE, do not enforce the current order of columns
Value
Either the gene or column names of the grandR data object, or the columns of an analysis table in the grandR object
Details
The genes are either the (often unreadable) gene ids (e.g. Ensembl ids), or the symbols.
Genes(data,use.symbols=FALSE)
it the same as rownames(data)
, and Columns(data)
is the same as colnames(data)
If both column and value are specified for GeneInfo
, a new column is added to the gene annotation table
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 having the Coldata
, i.e. you can use names of Coldata
as variables to
conveniently build a logical vector (e.g., columns=Condition=="x").
Examples
sars <- ReadGRAND(system.file("extdata", "sars.tsv.gz", package = "grandR"),
design=c("Cell",Design$dur.4sU,Design$Replicate))
#> Warning: Duplicate gene symbols (n=1, e.g. MATR3) present, making unique!
all(Genes(sars,use.symbols = FALSE)==rownames(sars))
#> [1] TRUE
all(Columns(sars)==colnames(sars))
#> [1] TRUE