Entering edit mode
9 months ago
Zeddicus
•
0
This is my first Biostars post and venture into R and seurat, so I apologize for the naivety of my question and if this has been answered elsewhere. It seems like this should be a common type of analysis question, but I have not been able to find out how to go about it via extensive Googling. Here are the steps I have taken and my question:
- Started with a complex tissue dataset which formed 11 low resolution clusters in the "original" seurat object.
- Subset the cells in "original" cluster-8 to form a separate "subset-1" seurat object containing 5 low resolution sub-clusters.
- Subset the cells in "subset-1" sub-cluster-1 to form a separate "subset-2" seurat object containing 6 high resolution sub-clusters.
How can I perform DE analysis of these "subset-2" sub-clusters compared to the rest of the "original" dataset?
Thanks in advance!
You can add a column to the metadata of the original object and labelled the cells based on the subsets. In pseudocode:
ifelse(rownames(meta.data) %in% cells_subset2,"cluster X","cluster Y")
.Thanks for your response! I tried:
everything@meta.data$endothelial_subclusters <- ifelse(rownames(everything@meta.data) %in% colnames(endothelial_cells), "endothelial_1", "other")
But everything in the new "endothelial_subclusters" metadata column is labelled as "other" and nothing else
No worries, I got it to work this way:
Got cell names:
Created a vector of labels For cells in the endothelial subset, labelled them as "EC", for others label them as "Other"
labels <- ifelse(cellnames_all %in% cellnames_ec, "EC", "Other")
Added the labels as a new column to the metadata
everything_ec <- AddMetaData(everything, metadata = labels, col.name = "Labels")
Checked if the new column was added
head(everything_ec@meta.data, n = 2)
Checked to see if subset of original cells had the right number of labels
Correct number of cells labelled with the "EC" label Can now do perform DE analysis
Checked list of DE genes
head(ec.vs.all.markers, n = 20)