Hello, this is my first post and my bioinformatic skillset is extremely limited so please bear with me.
I have a 10x Spatial object loaded into R, along with metadata correlating to each spot which I generated elsewhere. I have made a data frame and the first column being the barcode for each spot, and the 2nd column containing metadata (0-1 "subtype prediction" score). Link to metadata snip below.
The "score" column of the metadata is between 0 and 1, and I would like to plot this data over the tissue spots in order to visualize it with a color scale that correlates with this score.
I am having trouble adding the metadata to my Seurat object.
I have searched for a similar post but it seems like I am missing some basic coding skills in order to get this to work. I have the same number of barcodes as in the Seurat object in my first column and the barcodes are the same.
Thank you for your help!
Kyle
1 answer
Assuming the barcodes in the Seurat object metadata and in your data frame are in the same order, run one of the following commands in order to add a new column score to your Seurat metadata:
my_seurat_obj@meta.data$score <- my_data_frame$PurISTScore
Or:
my_seurat_obj$score <- my_data_frame$PurISTScore
Or:
my_seurat_obj[['score']] <- my_data_frame$PurISTScore
Log in to answer this question.

What commands have you tried?