RenameGenesSeurat: Rename Gene Symbols in a Seurat Object

View source: R/Seurat.Utils.R

RenameGenesSeuratR Documentation

Rename Gene Symbols in a Seurat Object

Description

This function replaces gene names across various slots within a specified assay of a Seurat object. It is designed to be run prior to any data integration or downstream analysis processes. The function targets the ⁠@counts⁠, ⁠@data⁠, and ⁠@meta.features⁠ slots within the specified assay, ensuring consistency in gene nomenclature across the object.

Usage

RenameGenesSeurat(
  obj = ls.Seurat[[i]],
  newnames = HGNC.updated[[i]]$Suggested.Symbol,
  assay = "RNA",
  slots = c("data", "counts", "meta.features")
)

Arguments

obj

A Seurat object containing the assay and slots to be updated. Default: ls.Seurat[[i]] (replace i with the appropriate index).

newnames

A character vector containing the new gene names intended to replace the existing ones. Default: HGNC.updated[[i]]$Suggested.Symbol. Ensure this matches the order and length of the genes in the specified assay.

assay

The name of the assay within the Seurat object where gene names will be updated; Default: "RNA". This function assumes simple objects containing only an RNA assay.

slots

A character vector specifying which slots within the assay to update. Possible values include "data", "counts", and "meta.features"; other layers can be specified if present.

Details

It is crucial to run this function before any data integration or further analysis to ensure gene symbol consistency. The function does not support complex objects with multiple assays where dependencies between assays might lead to inconsistencies. Use with caution and verify the results.

Note

This function modifies the Seurat object in place, changing gene symbols directly within the specified slots. Be sure to have a backup of your Seurat object if needed before applying this function.

Examples

## Not run: 
if (interactive()) {
  # Assuming `SeuratObj` is your Seurat object
  # and `HGNC.updated.genes` contains the updated gene symbols
  SeuratObj <- RenameGenesSeurat(
    obj = SeuratObj,
    newnames = HGNC.updated.genes$Suggested.Symbol
  )
  # `SeuratObj` now has updated gene symbols in the specified assay and slots
}

## End(Not run)


vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.