copyMiscElements: Copy Specified Elements from One Seurat Object's @misc to...

View source: R/Seurat.Utils.R

copyMiscElementsR Documentation

Copy Specified Elements from One Seurat Object's @misc to Another's

Description

Copies specified elements from the ⁠@misc⁠ slot of one Seurat object to the ⁠@misc⁠ slot of another. It warns if some specified elements are missing in the source object or if elements are overwritten in the destination object, depending on the overwrite argument.

Usage

copyMiscElements(obj.from, obj.to, elements.needed, overwrite = TRUE)

Arguments

obj.from

The source Seurat object from which elements in the ⁠@misc⁠ slot are to be copied.

obj.to

The destination Seurat object to which elements in the ⁠@misc⁠ slot are to be copied.

elements.needed

A vector of strings specifying the names of the elements in the ⁠@misc⁠ slot of obj.from that should be copied to obj.to.

overwrite

Logical indicating whether to overwrite elements in obj.to that already exist. If TRUE, existing elements will be overwritten with a warning; if FALSE, the function will stop with an error if it tries to copy an element that already exists in obj.to.

Value

Returns the modified destination Seurat object (obj.to) with the specified elements added to or updated in its ⁠@misc⁠ slot.

Examples

# Assuming `obj1` and `obj2` are Seurat objects and you wish to copy specific elements
# from obj1 to obj2, possibly overwriting existing elements in obj2
obj2 <- copyMiscElements(obj1, obj2, c("element1", "element2"), overwrite = TRUE)


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