renameAzimuthColumns: Rename Azimuth Columns in Seurat Object

View source: R/Seurat.Utils.Metadata.R

renameAzimuthColumnsR Documentation

Rename Azimuth Columns in Seurat Object

Description

Dynamically renames specified metadata columns in a Seurat object, particularly those prefixed with "predicted." and the "mapping.score" column, by applying a new prefix that combines a user-defined prefix and a reference name.

Usage

renameAzimuthColumns(
  obj,
  ref = c("humancortexref", "fetusref")[1],
  prefix = "azi",
  azim_cols = CodeAndRoll2::grepv(x = tail(colnames(obj@meta.data), 10), pattern =
    "predicted.")
)

Arguments

obj

A Seurat object containing metadata in meta.data that needs column names to be renamed.

ref

A character string specifying the reference; defaults to "humancortexref". The "ref" part of the string will be removed in the new column names.

prefix

A character string to prefix to the column names, defaulting to "azi". This prefix is combined with the modified ref to form the new column names.

azim_cols

Azimuth columns

Value

Returns the Seurat object with renamed metadata columns.

Examples

# Assuming `obj` is a Seurat object with metadata columns following the "predicted." pattern:
obj <- renameAzimuthColumns(obj, ref = "humancortexref", prefix = "azi")
# This will rename columns like "predicted.class" to "azi.humancortex.class"
# and include "mapping.score" as "azi.humancortex.mapping.score"


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