How to remove entire rows from seurat object based on cellhash read
Heres the last 3 columns of metadata from my seurat object (pbs.hashtag):
hash.ID percent.mt stim
AAACCCAAGGAGAGGC htag2 4.786380 VEH
AAACCCAAGTCTCTGA htag3 6.642512 VEH
AAACCCAAGTTTCAGC Doublet 2.559588 VEH
AAACCCACACAGTCAT Negative 4.982733 VEH
AAACCCACACGCGCAT htag2 3.220281 VEH
AAACCCACACGGATCC htag2 3.391841 VEH
I want to remove all rows from the object that have Doublet as the hash ID. Here's what I tried:
pbs.hashtag <- subset(pbs.hashtag, subset = meta.data@hash.ID != "Doublet")
it didn't work obvioulsy it says:
Error in FetchData(object = object, vars = expr.char[vars.use], cells = cells, : None of the requested variables were found:
Any ideas? I also tried meta.data$hash.ID in the subset line. Im pretty new to R and Seurat but I used to program some C 20 years ago so im getting back in the pool.
thanks!
• 11,651 views
•
link
1 answer
Guys I got it! DUHHHH
pbs.hashtag <- subset(pbs.hashtag, subset = hash.ID != "Doublet")
• 0 views
•
link
Log in to answer this question.
Hello,
could you please explain how how to get this doublet tag in the metadata?
thanks in advance!
Tushar
Hi there,
I tried to remove certain rows in my dataset as well using this function.
To clarify, I would like to remove all rows with Sample number 30 and 31 with the following code:
When I type in
dim(treg)and look at the dimensions, it seems to have worked as I seem to have removed 44 cells by doing this. However, when I typeView(treg@meta.data)and scroll down, I still see the cells that I wanted to have removed in my data frame. Am I doing something wrong? Is there a way to double check whether I have performed this properly? Why are my unwanted rows still present in my meta.data?Many thanks in advance, Florencia