View source: R/Seurat.Utils.Metadata.R
transferMetadata | R Documentation |
Transfers specified metadata columns from one Seurat object to another, with options for verbose output and overwriting existing columns. Checks for cell overlap and reports percentages of matching and unique cells.
transferMetadata(
from,
to,
colnames_from,
colnames_to = colnames_from,
overwrite = FALSE,
plotUMAP = TRUE,
strict = TRUE,
verbose = TRUE,
...
)
from |
The source Seurat object from which metadata will be transferred. |
to |
The destination Seurat object to which metadata will be added. |
colnames_from |
Vector of names for the columns in the source object's metadata to transfer. |
colnames_to |
Vector of names for the columns in the destination object's metadata.
Defaults to the same names as |
overwrite |
Logical, indicating whether to overwrite the column in the destination object if it already exists. Defaults to FALSE. |
plotUMAP |
Logical, indicating whether to plot UMAPs of the destination object with the new identity. |
strict |
Logical, indicating whether to fail if the destination object have cells not found in the source object. |
verbose |
Logical, indicating whether to print details about the transfer, including the number and percentage of matching cells between objects, and unique cells in each object. |
... |
Additional arguments to be passed to |
This function is useful for merging related data from separate Seurat objects, ensuring that relevant metadata is consistent across datasets. The function checks for the existence of the specified columns in the source object and whether the columns can be overwritten in the destination object. It also reports on cell overlap between the two objects, which can be useful for understanding the relationship between datasets.
Returns the destination Seurat object (to
) with the new metadata columns added.
# Assuming `object1` and `object2` are Seurat objects, and you want to transfer
# metadata columns named 'patientID' and 'treatmentGroup' from `object1` to `object2`:
object2 <- transferMetadata(
from = object1, to = object2,
colnames_from = c("patientID", "treatmentGroup")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.