isGene {dittoSeq} | R Documentation

## Tests if input is the name of a gene in a target object.

### Description

Tests if input is the name of a gene in a target object.

### Usage

    isGene(test, object, assay = .default_assay(object), return.values = FALSE)

### Arguments

`test` | String or vector of strings, the "potential.gene.name"(s) to check for.
`object` | A target Seurat or SingleCellExperiment object
`assay` | single string or integer that sets which set of seq data inside the object to check.
`return.values` | Logical which sets whether the function returns a logical `TRUE`/`FALSE` versus the `TRUE` `test` values . Default = `FALSE` REQUIRED, unless '`DEFAULT <- "object"`' has been run.

### Value

Returns a logical vector indicating whether each instance in `test` is a rowname within the requested `assay` of the `object`. Alternatively, returns the values of `test` that were indeed rownames if `return.values = TRUE`.

### Author(s)

Daniel Bunis

### See Also

`getGenes` for returning all genes in an `object`

`gene` for obtaining the expression data of genes

### Examples

    example(importDittoBulk, echo = FALSE)

    # To see the first 10 genes of an object of a particular assay
    getGenes(myRNA, assay = "counts")[1:10]

    # To see all genes of an object for the default assay that dittoSeq would use
    # leave out the assay input (again, remove `head()`)
    head(getGenes(myRNA))

    # To test if something is a gene in an object:
    isGene("gene1", object = myRNA) # TRUE
    isGene("CD12345", myRNA) # FALSE

    # To test if many things are genes of an object
    isGene(c("gene1", "gene2", "not-a-gene", "CD12345"), myRNA)

    # 'return.values' input is especially useful in these cases.
    isGene(c("gene1", "gene2", "not-a-gene", "CD12345"), myRNA,
        return.values = TRUE)

[Package dittoSeq version 0.99.14 Index]