Get and set feature and cell inames in Seurat objects

# S3 method for Seurat
dimnames(x)

# S3 method for Seurat
dimnames(x) <- value

Arguments

x

A Seurat object

value

A two-length list with updated feature and/or cells names

Value

dimnames: A two-length list with the following values:

  • A character vector with all features in the default assay

  • A character vector with all cells in x

dimnames<-: x with the feature and/or cell names updated to value

See also

Seurat object, validity, and interaction methods $.Seurat(), Seurat-class, Seurat-validity, [[.Seurat(), [[<-,Seurat, [[<-,Seurat,NULL, dim.Seurat(), merge.Seurat(), names.Seurat(), subset.Seurat()

Cells(), dimnames.Assay(), dimnames.Assay5()

Examples

# Get the feature names of an object
head(rownames(pbmc_small))
#> [1] "MS4A1"    "CD79B"    "CD79A"    "HLA-DRA"  "TCL1A"    "HLA-DQB1"

# Get the cell names of an object
head(colnames(pbmc_small))
#> [1] "ATGCCAGAACGACT" "CATGGCCTGTGCAT" "GAACCTGATGAACC" "TGACTGGATTCTCA"
#> [5] "AGTCAGACTGCACA" "TCTGATACACGTGT"

colnames(pbmc_small)[1] <- "newcell"
head(colnames(pbmc_small))
#> [1] "newcell"        "CATGGCCTGTGCAT" "GAACCTGATGAACC" "TGACTGGATTCTCA"
#> [5] "AGTCAGACTGCACA" "TCTGATACACGTGT"