Check that user-defined gene input matches expected values

matchesGene2Symbol(x, genes, gene2symbol, .xname = getNameInParent(x))

Arguments

x

Object class supporting rownames(). All rownames in this object must intersect with the rownames defined in the gene2symbol argument.

genes

character. Gene identifiers. It is considered better practice to input the stable gene identifiers from Ensembl (e.g. "ENSG00000000003") and not the (HGNC) gene symbols (e.g. "TSPN6"), if possible.

gene2symbol

Gene2Symbol. Gene-to-symbol mappings. Must contain geneID and geneName columns. See Gene2Symbol for more information.

.xname

Not intended to be used directly.

Value

No value.

Examples

x <- S4Vectors::DataFrame( "sample1" = c(1L, 2L), "sample2" = c(3L, 4L), row.names = c("gene1", "gene2") ) print(x)
#> DataFrame with 2 rows and 2 columns #> sample1 sample2 #> <integer> <integer> #> gene1 1 3 #> gene2 2 4
g2s <- Gene2Symbol( object = S4Vectors::DataFrame( geneID = c("ENSG00000000003", "ENSG00000000005"), geneName = c("TSPAN6", "TNMD"), row.names = rownames(x) ) ) print(g2s)
#> Gene2Symbol with 2 rows and 2 columns #> geneID geneName #> <character> <character> #> gene1 ENSG00000000003 TSPAN6 #> gene2 ENSG00000000005 TNMD
geneIDs <- g2s[["geneID"]] print(geneIDs)
#> [1] "ENSG00000000003" "ENSG00000000005"
geneNames <- g2s[["geneName"]] print(geneNames)
#> [1] "TSPAN6" "TNMD"
matchesGene2Symbol(x = x, genes = geneIDs, gene2symbol = g2s)
#> [1] TRUE
matchesGene2Symbol(x = x, genes = geneNames, gene2symbol = g2s)
#> [1] TRUE