I am working with a R package called "Seurat" for single cell RNA-Seq analysis. I am trying to add metadata information about individual cell samples to the Seurat Object. But the downstream plotting commands are not working. I am wondering if anyone knows how I could check the modified Seurat object to confirm that the metadata was added in the correct slot and column.
To add the metadata i used the following commands.
First I extracted the cell names from the Seurat object
> Cells <- WhichCells(seurat_object)
Then I created a list of the morphologically determined cell types using numbers 1-3 this NOTE: the list is much longer but abbreviated as the first 3 here
> MorphCellTypes = c(1,2,3)
Then I merged cells and MorphCellTypes together as a data.frame
> MorphCellTypesDF = data.frame(Cells, MorphCellTypes)
Then I tried to add this MorphCellTypesDF metadata to the seurat object using the following command which ran successfully
> AddMetaData(Sleuth_object, MorphCellTypesDF, col.name = MorphCellTypes
Then I tried to visualize it with TSNEPlot using the following command
> TSNEPlot(pbmc, do.label = TRUE, pt.size = 3, group.by = MorphCellTypes
This returned the following Error:
“Error in DimPlot(object, reduction.use = "tsne", cells.use = cells.use, :
object 'MorphCellTypes' not found”
So I think that I am either adding the meta data to the wrong location in my seurat object or i am somehow messing up the col.name. Either way it appears that I am using the AddMetaData or TSNEPlot() functions incorrectly. If by any chance you spot the error or could point me to an example of how to use AddMetaData it would be very much appreciated.
[email protected]
instead of[email protected]
. Thanks. – Auvil