LoginSignup
1
0

More than 3 years have passed since last update.

rentrezでNCBI Geneの情報を取得

Last updated at Posted at 2019-06-18

Ensemblが返すNCBI Gene IDが一意じゃなかった件について
でまとめた通り、NCBI Gene IDは、Ensemblを経由すると一意なIDではなくなってしまう。

ただし、これは管理している組織も国もポリシーも違うのでしょうがないのかもしれない。

BiomartやbiomaRtパッケージが便利すぎるから使っていたが、
NCBI側が作ったIDを使う以上は、NCBIに検索をかけるのが筋だとも思い直したので、
rentrezパッケージを使って、NCBI Gene IDからGene Symbolの取得を試みた。

ただし、biomaRtほど便利ではなく、数年ぶりにXMLのパースなんてことをやった。
以下のように、Xpath式で階層を下っていけば、目的のGene Symbolにたどり着けた。

install.packages("rentrez", repos="http://cran.r-project.org")
install.packages("XML", repos="http://cran.r-project.org")
library("rentrez")
library("XML")

geneid <- c("6013", "6019")
rln <- entrez_fetch(db="gene", id=geneid, rettype="xml")
rln <- xmlInternalTreeParse(rln)
symbol <- xpathSApply(rln, "//Entrezgene-Set/Entrezgene/Entrezgene_gene/Gene-ref/Gene-ref_locus", xmlValue)

data.frame(
    external_gene_name=symbol,
    entrezgene=geneid)
#   external_gene_name entrezgene
# 1               RLN1       6013
# 2               RLN2       6019

これにより、少なくとも同じNCBI Gene IDに、複数のGene Symbolが着くなんて事はなさそう。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0