Removing features from RNA assay in seurat
0
0
Entering edit mode
9 weeks ago
Varun Gupta ★ 1.3k

I have a seurat object which looks like this:

An object of class Seurat 
31061 features across 6471 samples within 2 assays 
Active assay: RNA (31057 features, 0 variable features)
 1 layer present: counts.Gene Expression
 1 other assay present: HTO

I have 2 assays, RNA and HTO. I want to remove 4 genes from RNA assay. These 4 genes are also part of HTO assay. When I use subset like below:

obj <- subset(obj, features = setdiff(rownames(obj), antibody_capture_genes))

this is how my object looks like now:

An object of class Seurat 
31053 features across 6471 samples within 1 assay 
Active assay: RNA (31053 features, 0 variable features)
 1 layer present: counts.Gene Expression

So, I also loose the HTO assay. How can I just remove the genes from the RNA assay?

R SEURAT sc-RNA-Seq • 395 views
ADD COMMENT
1
Entering edit mode

I probably wouldn't recommend doing this, but anyway:

You can subset the assay rather than the whole object

test.seurat[["RNA2"]] <- test.seurat[["RNA"]]
features.sub <- sample(Features(test.seurat), 1000, replace = FALSE)
test.seurat[["RNA2"]] <- subset(test.seurat[["RNA2"]], features = features.sub)

DefaultAssay(test.seurat) <- "RNA"
nrow(test.seurat)
> [1] 27132
DefaultAssay(test.seurat) <- "RNA2"
nrow(test.seurat)
> [1] 1000
ADD REPLY
0
Entering edit mode

What happens to the HTO assay?

ADD REPLY
1
Entering edit mode

In your code:

obj[["RNA"]] <- subset(obj[["RNA"]], features = setdiff(rownames(obj[["RNA"]]), antibody_capture_genes))

This shouldn't affect the HTO assay

ADD REPLY

Login before adding your answer.

Traffic: 2656 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