Hi,
I'm trying to figure out how to remove a set of genes from my SingleCellExperiment
container (sce
). I have a data.frame called mito.genes
with a list of genes as shown here:
Entrez_ID Symbol Ensembl_ID 1 66445 Cyc1 ENSMUSG00000022551 2 18597 Pdha1 ENSMUSG00000031299 3 66043 Atp5d ENSMUSG00000003072 4 74316 Isca2 ENSMUSG00000021241 5 22273 Uqcrc1 ENSMUSG00000025651 6 68263 Pdhb ENSMUSG00000021748
My sce
has the following:
rowData(sce)$Ensembl_ID <- ids #row metadata rownames(sce) <- Gene_Names #row names as gene symbols
I tried this:
gene.symbols <- mito.genes$Symbol sce <- sce[,!gene.symbols]
But get an error:
"Error: logical subscript contains NAs In addition: Warning message: In Ops.factor(gene.symbols) : ‘!’ not meaningful for factors"
The list of genes does not contain any NAs (it's a relatively short list). When I tried changing the data.frame Symbol
to rownames
then running the same script above, I get Error in !gene.symbols : invalid argument type
.
I also tried going about this prior to creating the sce
container by creating a new column with my gene symbols, then using dyplr
's anti_join()
function to successfully remove the rows from the main count matrix, however, when I remove the column with the gene symbols and create an sce
, I end up with the sce
containing what looks like lists and not numeric values.
Any guidance would be much appreciated.
Fix the formatting in your post, the markdown editor isn't working properly at the moment.
Hopefully fixed now (I had to edit 2-3 times because it didn't look proper).