In Seurat 3, you can export the coordinates to a dataframe using Embeddings()
.
umapCoord <- as.data.frame(Embeddings(object = AD007[["umap"]]))
You can then add the PC columns to the meta.data
as you please (cbind
, sapply
, paste(..,collapse=)
,...)
For example, if you only need to add the PCs components, without modifying them or doing other processing, you can do a simple merge
metadata_table <- AD007@meta.data
metadata_table$UMI_id <- rownames(metadata_table)
umapCoord$UMI_id <- rownames(umapCoord)
metadata_table <- merge.data.frame(metadata_table,umapCoord,by = "UMI_id")
metadata_table$UMI_id <- NULL
AD007@meta.data <- metadata_table
or if you want to be "seurat compliant"
AddMetaData(AD007, metadata=metadata_table)`
Always double check that the order of the cells between the metadata and the umap match.
•
link
modified 3 months ago
•
written
3 months ago by
fracarb8 • 50