Check that user-defined gene input matches expected values

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

Arguments

x

Object.

genes

character. Gene identifiers.

gene2symbol

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

.xname

Name of object defined in x. Not intended to be used directly.

Value

TRUE on success; FALSE on failure, with cause set.

Note

Updated 2020-10-05.

Examples

x <- 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 = 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