Designed for fast variable creation when a new variable is going to be created from existing variable. For example, mapping multiple samples to experimental condition.

Map_New_Meta(seurat_object, from, new_col = NULL, ...)

Arguments

seurat_object

name of Seurat object

from

current column in meta.data to map from

new_col

name of new column in meta.data to add new mapped variable. If NULL (default) will return the variable. If name provided will return Seurat object with new variable added.

...

Mapping criteria, argument names are original existing categories in the from calumn and values are new categories in the new variable.

Value

if new_col = NULL returns factor else returns Seurat object with new variable added.

References

This function is slightly modified version of LIGER function mapCellMeta to allow functionality with Seurat objects. https://github.com/welch-lab/liger. (License: GPL-3).

Examples

if (FALSE) {
seurat_object <- Map_New_Meta(seurat_object, from = "orig.ident", new_col = "Treatment",
"1" = "Ctrl", "2" = "Treated", "3" = "Treated", "4" = "Ctrl")
}