Adding metadata to Visium Seurat object
1
1
Entering edit mode
18 months ago

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.

screenshot

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

visium • 1.1k views
ADD COMMENT
0
Entering edit mode

What commands have you tried?

ADD REPLY
0
Entering edit mode
18 months ago
Ribo ▴ 40

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
ADD COMMENT

Login before adding your answer.

Traffic: 2411 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6