Is there a way to filter genes after having created the Seurat object?
In the CreateSeuratObject function, there's:
> # filter genes on the number of cells expressing
> # modifies the raw.data slot as well now
> genes.use <- rownames(object@data)
> if (min.cells > 0) {
> num.cells <- rowSums(object@data > 0)
> genes.use <- names(num.cells[which(num.cells >= min.cells)])
> [email protected] <- [email protected][genes.use, ]
> object@data <- object@data[genes.use, ]
> }
and, similarly to filtering based on cells, it would be useful to be able to perform these operations during subsequent QC steps instead (or in addition to) the initial object creation.
Agreed - we'll fix in a future release
Hello! Any update on whether this function was introduced? Thanks for all your work.
We looked into this further and decided that gene filtration could be misleading, as that could throw off normalization assumptions, etc.
We suggest that you filter genes in the original expression matrix, prior to constructing the Seurat object.
What would you recommend after subsetting cells (after cluster analysis), in which some genes are now present in only a few cells (1-3)? It would be great to remove those genes prior to run FindVariableGenes.
I want to filter cells after obtaining clusters. This is because, in my case for few cells, some important genes are not expressed (but they are in the same cluster with other cells which have important genes), so I don't want them to be look for DEGs while running FindMarkers. But when I tried to filter the cells using ID
FilterCells(a.combined, subset.names='rep1_AAACCTGAGTGTGAAT')
I got error as
Error in FetchData(object = object, vars.all = subset.name, cells.use = cells.use, :
Error: rep1_AAACCTGAGTGTGAAT not found
Is there a way to remove those cells which are not important for comparison for DEGs after forming clusters?
You can provide a vector of cell names to include in the subset to the cells.use parameter. Just exclude the cells you want to filter from that vector.
Most helpful comment
What would you recommend after subsetting cells (after cluster analysis), in which some genes are now present in only a few cells (1-3)? It would be great to remove those genes prior to run FindVariableGenes.