R:gene symbol与id转换

利用R将gene symbol与id转换

安装所需包

if (!requireNamespace(“BiocManager”, quietly = TRUE))
install.packages(“BiocManager”)

BiocManager::install("org.Hs.eg.db")

R:gene symbol与id转换

运行代码

library("org.Hs.eg.db") #加载人源包,鼠org.Mm.eg.db
rt=read.table("symbol.txt",sep="\t",check.names=F,header=T) #读取文件
genes=as.vector(rt[,1])
entrezIDs <- mget(genes, org.Hs.egSYMBOL2EG, ifnotfound=NA) #找出基因对应的id
entrezIDs <- as.character(entrezIDs)
out=cbind(rt,entrezID=entrezIDs)
write.table(out,file="id.txt",sep="\t",quote=F,row.names=F) #输出结果

本站原创,如若转载,请注明出处:https://www.ouq.net/110.html

(1)
打赏 微信打赏,为服务器增加50M流量 微信打赏,为服务器增加50M流量 支付宝打赏,为服务器增加50M流量 支付宝打赏,为服务器增加50M流量
上一篇 03/16/2020 00:41
下一篇 03/17/2020 00:37

相关推荐

  • R:无法安装ncdf4,错误nc-config… no|解决

    无法安装ncdf4,错误nc-config… no: ‘getOption(“repos”)’ replaces Bioconductor standard repositorie…

    R 2天前
    13
  • Rstudio/Rstudio Server enable Copilot-Rstudio Server打开Copilot

    Rstudio Server 默认是关闭Copilot Copilot is turned off by default. Copilot is turned off with copilot-enabled=0 in /etc/rstud…

    R 06/05/2025
    138
  • R_Code: KEGG analysis

    library(clusterProfiler) library(org.Hs.eg.db) # 读取输入数据文件 file_path <- “C:/Users/Lamarck/Desktop/UP_genes_ENSEMBL_ENT…

    R 06/02/2025
    164
  • R_Code:GO and Functional GO

    GO analysis: library(AnnotationDbi) library(org.Hs.eg.db) #基因注释包 library(clusterProfiler) #富集包 # 读取CSV文件 file_path <-…

    R 06/02/2025
    166
  • R_Code:WGCNA and WGCNA_Get_Gene_Length

    library(WGCNA) library(DESeq2) # enableWGCNAThreads(nThreads = 10) # 在处理数据框(data.frame)时,不会自动给将String类型转换成factor类型 optio…

    R 06/02/2025
    161