Filtering genes in scRNA-seq
0
0
Entering edit mode
2.1 years ago
learner-MD ▴ 30

After clustering of approx. 25,000 cells from 2 different conditions, I'm doing DEG analysis via edgeR. One of the things I'm trying to do after subsetting my cluster of interest is to only include genes with non-zero expression in at least 5% off cells in that cluster for the DEG analysis. I've done the below to include genes that are expressed in at least 1 cell before converting the cell x gene table into a sample x gene table for edgeR:

new_object <- subset(seurat_object, idents = "cluster_of_interest")
counts <- GetAssayData(object = new_object, slot = "counts", assay = "RNA")
nonzero <- counts >0
keep_genes <- Matrix::rowSums(nonzero) >= 1
filtered_counts <- counts[keep_genes,]
filtered_object <- CreateSeuratObject(filtered_counts, meta.data = new_object@meta.data)

Any suggestions on adjusting the script to include only genes with non-zero expression in 5% or more of cells? Thanks in advance!

seurat deg dge scrnaseq • 512 views
ADD COMMENT
0
Entering edit mode

Something like this (not tested)?

keep_genes <- Matrix::rowSums(nonzero) >= as.integer(ncol(counts)*0.05)
ADD REPLY

Login before adding your answer.

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