I am usingPeripheral Blood Mononuclear Cells (PBMC) data from Seurat website (https://satijalab.org/seurat/pbmc3k_tutorial.html) I am trying to get gene information by using biomaRt package on R.
library(biomaRt)
ensembl <- useMart("ensembl",
dataset = "hsapiens_gene_ensembl")
pbmc_filter <- pbmc@var.genes
attr <- c("ensembl_gene_id", "hgnc_symbol","entrezgene","chromosome_name", "start_position", "end_position")
Info <- getBM(attributes = attr,
filters = "hgnc_symbol",
values = pbmc_filter,
mart = ensembl)
This is the code that I used but the problem is pbmc_filter or pbmc@var.genes have 1838 genes but this code only gives 1625 gene information (after deleting repetitive hgnc_symbol names).
I found that some of the gene information is not in hsapiens_gene_ensembl dataset. For example, "CPSF3L" is in pbmc_filter but not in hsapiens_gene_ensembl dataset. Is there anyone who can figure out how to get all 1838 gene information by using biomaRt?
Thank you in advance.
As an alternative, you can use
mapIds
directly