探针注释之其他基因id转换

0.介绍一下find_anno

我搞了一个函数,名叫find_anno,可以根据GPL平台编号给出探针注释的代码

第一种情况是有两个代码可以用

例如

library(tinyarray)
find_anno("GPL570")
## `library(hgu133plus2.db);ids <- toTable(hgu133plus2SYMBOL)` and `ids <- AnnoProbe::idmap('GPL570')` are both avaliable

## if you get error by idmap, please try different `type` parameters

给出的红色字里面就有代码啦,注意看字,就是下面这两句都可以,选其中一个即可:

library(hgu133plus2.db);ids <- toTable(hgu133plus2SYMBOL)
ids <- AnnoProbe::idmap('GPL570')

第二种情况是只有AnnoProbe的代码可以用

find_anno("GPL16570")

## no annotation packages avliable,please use `ids <- AnnoProbe::idmap('GPL16570')`

## if you get error by this code ,please try different `type` parameters
#然后原样抄代码就会报错了嘞
ids <- AnnoProbe::idmap('GPL16570')
## Error in download.file(paste0(up, down), dt, mode = "wb"): cannot open URL 'http://49.235.27.111/GEOmirror/GPL/GPL16570_bioc.rda'

其实find_anno给出结果的最后一句就是答案

注意看:if you get error by this code ,please try different type parameters

唉,表达能力有限,多写点字解释一下。

就是说idmap它有不同的type参数,我打出来的代码没带上这个参数,如果直接用报错了,就得试试看哪个能得出结果。

查帮助文档会发现type参数有三个选择

挨个试试嘛就!然后就试出来了呀。

ids <- AnnoProbe::idmap('GPL16570',type = "soft")

第三种情况是没有查到可用的注释

比如今天的GPL30971

find_anno("GPL30971")

## no annotation avliable in Bioconductor and AnnoProbe

没有注释可用,没有就是没有。所以我们可以去GPL网页上看看有没有相应的注释

好消息,有,坏消息,不能直接用还得转换一下id

再介绍一个函数get_gpl_txt

他可以给出GPL网页上的表格文件下载链接,有的页面没给下载键,用这个函数获取下载地址然后下载。

get_gpl_txt("GPL30971")

## https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GPL30971&targ=self&form=text&view=data

网址复制到浏览器,就可以下载到这个文件了。放在工作目录下

最后是转换id啦

f = data.table::fread("GPL30971.txt",data.table = F)
colnames(f)

## [1] "ID"             "ENTREZ_GENE_ID" "Description"    "SPOT_ID"

ids = f[,c("ID","ENTREZ_GENE_ID")]
#转换id
library(clusterProfiler)
library(org.Hs.eg.db)
e2s = bitr(ids$ENTREZ_GENE_ID,
           fromType = "ENTREZID",
           toType = "SYMBOL",
           OrgDb = "org.Hs.eg.db")
#合并在一起
ids = merge(ids,e2s,by.x = "ENTREZ_GENE_ID",by.y = "ENTREZID")
colnames(ids)

## [1] "ENTREZ_GENE_ID" "ID"             "SYMBOL"

#卸磨杀驴,不再需要ENTREZID了
ids = ids[,-1]
colnames(ids) =  c("probe_id","symbol")
ids = na.omit(ids)
head(ids)

##   probe_id   symbol
## 1     1_at     A1BG
## 2     2_at      A2M
## 3     3_at    A2MP1
## 4     9_at     NAT1
## 5    10_at     NAT2
## 6    12_at SERPINA3

可以啦。就是这样。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容