Question: How to remove entire rows from seurat object based on cellhash read
0
gravatar for cook.675
14 months ago by
cook.67540
cook.67540 wrote:

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!

seurat • 1.8k views
ADD COMMENTlink modified 6 months ago by f.morgana0 • written 14 months ago by cook.67540

Hello,

could you please explain how how to get this doublet tag in the metadata?

thanks in advance!

Tushar

ADD REPLYlink written 12 months ago by tushard19870

Hi there,

I tried to remove certain rows in my dataset as well using this function.

                                   Sample donor organ sort method file is.TRA.p is.TRB.p is.TRA.np

FCAImmP7179369-AAACGGGTCTGTCAAG      6     3     0    1      0    2    FALSE    FALSE     FALSE
FCAImmP7179369-AAATGCCAGCTTATCG      6     3     0    1      0    2    FALSE    FALSE     FALSE
FCAImmP7179369-AACTCAGTCATTGCGA      6     3     0    1      0    2    FALSE    FALSE     FALSE
FCAImmP7179369-AAGCCGCAGTGTCCCG      6     3     0    1      0    2    FALSE    FALSE     FALSE
FCAImmP7179369-AAGTCTGCACAGCCCA      6     3     0    1      0    2    FALSE    FALSE     FALSE
FCAImmP7179369-ACACCGGGTTCCACGG      6     3     0    1      0    2    FALSE    FALSE     FALSE

To clarify, I would like to remove all rows with Sample number 30 and 31 with the following code:

treg <- subset(treg, subset = Sample != c("30", "31"))

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 type View(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

ADD REPLYlink written 6 months ago by f.morgana0
0
gravatar for cook.675
14 months ago by
cook.67540
cook.67540 wrote:

Guys I got it! DUHHHH

pbs.hashtag <- subset(pbs.hashtag, subset = hash.ID != "Doublet")
ADD COMMENTlink written 14 months ago by cook.67540
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1433 users visited in the last hour