[英]How can I convert gene names (hgnc_symbol) to Ensemble IDs in R? “bioconductor-biomaRt”
I have a list of genes as rownames of my eset and I want to convert them to Ensembl gene ID. 我有一个基因列表作为我的eset的行名,我想将它们转换为Ensembl基因ID。 I used getGene in bioMart package but it took the same name twice for some genes! 我在bioMart软件包中使用了getGene,但是对于某些基因它两次使用了相同的名称! here is a small example for my code: 这是我的代码的一个小例子:
library (biomaRt)
rownames(eset)
[1] "EPC1" "MYO3A" "PARD3" "ATRNL1" "GDF2" "IL10RA" "GAD2" "CCDC6"
getGene(rownames(eset),type='hgnc_symbol',mart)[c(1,9)]
# [1] is the hgnc_symbol to recheck the matched data
# [9] is the ensemble_gene_id
hgnc_symbol ensembl_gene_id
1 ATRNL1 ENSG00000107518
2 CCDC6 ENSG00000108091
3 EPC1 ENSG00000120616
4 GAD2 ENSG00000136750
5 GDF2 ENSG00000263761
6 IL10RA ENSG00000110324
7 IL10RA LRG_151
8 MYO3A ENSG00000095777
9 PARD3 ENSG00000148498
As you can see there are two entries for "IL10RA" in the hgnc_symbol column; 如您所见,hgnc_symbol列中有两个“ IL10RA”条目; but I only had one "IL10RA" in the rownames(eset); 但行名(eset)中只有一个“ IL10RA”; this causes a problem at the end when I wanted to add the Ensembl_ID to the fData(eset)! 当我想将Ensembl_ID添加到fData(eset)时,这最终会导致问题! How can I solve this problem? 我怎么解决这个问题? to have result like this: 得到这样的结果:
hgnc_symbol ensembl_gene_id
1 ATRNL1 ENSG00000107518
2 CCDC6 ENSG00000108091
3 EPC1 ENSG00000120616
4 GAD2 ENSG00000136750
5 GDF2 ENSG00000263761
6 IL10RA ENSG00000110324
7 MYO3A ENSG00000095777
8 PARD3 ENSG00000148498
Thanks in advance, 提前致谢,
I've found the solution by !duplicated in the eset. 我在eset中找到了!duplicated的解决方案。 Something like this: 像这样:
g_All <- getGene(id = rownames(eset)),type='hgnc_symbol',mart)
g_All <- g_All[!duplicated(g_All[,1]),]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.