ID转换大全-3-使用R语言获取人类所有基因的名字,ID,symbol以及别名

使用R语言获取人类所有基因的名字,ID,symbol以及别名

参考https://vip.biotrainee.com/d/761-r-id-symbol

首先肯定是需要自行搜索了解 entrez gene ID, HUGO symbol, refseq ID, ensembl ID 这些专有名词咯。

然后直接把下面的代码运行一下,把输出的all_gene_bioconductor.html文件好好看看, 就明白了。

rm(list=ls())
getwd()
library(org.Hs.eg.db)
eg2symbol=toTable(org.Hs.egSYMBOL)
eg2name=toTable(org.Hs.egGENENAME)
eg2alias=toTable(org.Hs.egALIAS2EG)
eg2alis_list=lapply(split(eg2alias,eg2alias$gene_id),function(x){paste0(x[,2],collapse = ";")})
GeneList=mappedLkeys(org.Hs.egSYMBOL)
if( GeneList[1] %in% eg2symbol$symbol ){
  symbols=GeneList
  geneIds=eg2symbol[match(symbols,eg2symbol$symbol),'gene_id']
}else{
  geneIds=GeneList
  symbols=eg2symbol[match(geneIds,eg2symbol$gene_id),'symbol']
}
geneNames=eg2name[match(geneIds,eg2name$gene_id),'gene_name']
geneAlias=sapply(geneIds,function(x){ifelse(is.null(eg2alis_list[[x]]),"no_alias",eg2alis_list[[x]])})

createLink <- function(base,val) {
  sprintf('%s',base,val) ##target="_blank" 
}
gene_info=data.frame(   symbols=symbols,
                        geneIds=createLink(paste0("http://www.ncbi.nlm.nih.gov/gene/",geneIds),geneIds),
                        geneNames=geneNames,
                        geneAlias=geneAlias,
                        stringsAsFactors = F
) 
#library("xtable") 
#print(xtable(gene_info), type="html",include.rownames=F, file='all_gene.anno',sanitize.text.function = force)
file='C:/Users/ljx/Desktop/programmelanguage/5years-master/ID_transfer/all_gene_bioconductor.html'

?
library(BiocManager)
BiocManager::install("DT")

library(DT)
y <- DT::datatable(gene_info,escape = F,rownames=F)
DT::saveWidget(y,file)

在输出的文件里面可以搜索:

symbols geneIds geneNames geneAlias
EGFR 1956 epidermal growth factor receptor ERBB;ERBB1;HER1;NISBD2;PIG61;mENA;EGFR
ERBB2 2064 erb-b2 receptor tyrosine kinase 2 CD340;HER-2;HER-2/neu;HER2;MLN 19;NEU;NGL;TKR1;ERBB2
ERBB3 2065 erb-b2 receptor tyrosine kinase 3 ErbB-3;HER3;LCCS2;MDA-BF-1;c-erbB-3;c-erbB3;erbB3-S;p180-ErbB3;p45-sErbB3;p85-sErbB3;ERBB3
ERBB4 2066 erb-b2 receptor tyrosine kinase 4 ALS19;HER4;p180erbB4;ERBB4

可以看到,有趣的是 ERBB1家族的 ERBB1的正式名字就是大名鼎鼎的EGFR, 而 大名鼎鼎的HER-2 正式名字却是ERBB2

其实基因名总是让我困惑,可能是我生物学基础知识不够扎实,比如

  • SMARCA4 (BRG1; Santa Cruz Biotechnology, sc-17796, 1:300 dilution)
  • SMARCC2 (BAF170; Bethyl Laboratories, A301-039A, 1:1,000 dilution)
  • SMARCD1 (BAF60A; Bethyl Laboratories, A301-595A, 1:3,000 dilution), SMARCE1 (BAF57; Bethyl Laboratories, A300-810A, 1:3,000 dilution), SMARCB1 (SNF5; Bethyl Laboratories, A301-087A, 1:5,000 dilution), ACTL6A (BAF53A; Bethyl Laboratories, A301-391A, 1:3,000 dilution)

都是 SWI/SNF Related, Matrix Associated, Actin Dependent Regulator Of Chromatin,我是在genecard里面 检查 SMARC发现的
http://www.genecards.org/Search/Keyword?queryString=SMARC
但是大部分文章里面却总是使用它们的别名。

你可能感兴趣的:(ID转换大全-3-使用R语言获取人类所有基因的名字,ID,symbol以及别名)