I have a seurat object, with raw counts stored in the RNA assay at object@assays[["RNA"]]@counts
Lets say that the count matrix is simple and looks like this, where letters are genes and numbers are cells:
[1] [2] [3]
[A] 2 4 3
[B] 1 5 7
[C] 2 3 4
I want to subset out all the cells that have expression of gene A >= 3. So that if I did that the resulting matrix would look like this:
[2] [3]
[A] 4 3
[B] 5 7
[C] 3 4
Im having trouble getting the right syntax for this, specifically how to call only that one gene within a Subset function and still retain all the other genes in the list
I tried subsetting out the count matrix like this:
then running:
Subset <- data.frame[, "A" >= 4]
and it returned all values
I also tried
Subset <- data.frame[, data.frame$"A" >= 4]
I found a solution if anyone has interest. Take the data out of the object first as a data frame (df) then: