Description Usage Arguments Value Examples
get_gene_names()
extracts gene names from a matrix, data frame, or
Seurat object. For a martix or data frame, you need to tell it whether the
gene names are in row names or column names. If it's a Seurat object,
you'll need to specify the assay you want.
1 2 3 4 5 6 7 | get_gene_names(x, ...)
## Default S3 method:
get_gene_names(x, use.row = FALSE, ...)
## S3 method for class 'Seurat'
get_gene_names(x, assay = "RNA", ...)
|
x |
an object (matrix, data frame, or Seuratv3 object) to extract gene names from |
... |
other arguments passing to S3 methods (see below) |
use.row |
a logical constant indicating whether the gene names are in row names or not |
assay |
a character string indicating an assay in the Seurat object |
a character vector
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Create a dummy expression matrix
expression_df <- data.frame(
"sample1" = c(1:10),
"sample2" = c(1:10),
"sample3" = c(1:10)
)
row.names(expression_df) <- c(paste("gene", c(1:10), sep = ""))
# Create Seurat object from the dummy data
seuratobj <- Seurat::CreateSeuratObject(counts = expression_df,
assay = "RNA")
# Get gene names from a data frame
get_gene_names(expression_df, use.row = TRUE)
# Get gene names from a Seuratv3 object
get_gene_names(seuratobj, assay = "RNA")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.