BH11.11/統合検索とRDFからの表データ生成

提供:TogoWiki

移動: 案内, 検索

目次

目標

  • サンプルデータを使ってプロトタイプ(実際に動くモノ)を作る

イメージ

  • ユーザが手持ちのデータをアップロード
  • IDのカラムを指定
  • アノテーションを追加するDB名を指定
  • 追加するattributeを指定
  • ユーザが結果をダウンロード

作業

  • 公共データベース(サンプルデータ)のRDF化 → Virtuoso
    • UniProt
    • DDBJ
    • Entrez
    • (KEGG)
    • GO
    • ウイルスRDF
    • GTPS
  • DBごとのpredicateのリスト化

検討事項

  • predicateの追加・変更にどう対応するか
  • 複数のトリプルが1つのセルに対応する場合どうするか
  • 各エントリにrdf:typeをつけるべき?
  • (データ保持をどうするか)

今後の予定

  • ニーズのありそうなDBの調査・RDFデータインポート(GO, PDBj, Pfam, etc...)
  • 表に追加する項目のリストアップ
  • 上記項目についてアノテーション追加機能を実装
  • 各項目を取得するためのSPARQL調査(predicateのリスト化)uniprot, ddbj
  • データ量が増えたときにどれくらいスケールするか

サンプルデータ

作業用のファイルは afp://lion.local のユーザ bh11 の public フォルダに置いた(AirMac BH11 でフォルダに接続)。

UniProt

  • 河野さんより esi_sample.txt プロテオミクスのデータ
  • 第7カラムの UniProt ID から対応する RDF を取得(適当なスクリプト)
 % curl http://www.uniprot.org/uniprot/P17677.rdf?include=yes -o rdf/P17677.rdf
 % (cd rdf; for i in *.rdf
 do
   rapper -i rdfxml -o ntriples $i http://bh.dbcls.jp/ > ../n3/$i.n3
 done)
 % cat n3/* > all.n3
 % rapper -i ntriples -o rdfxml all.n3 > all.rdf
 % ls rdf | wc -l
     81
 % wc -l all.rdf
   467157 all.rdf

たった81エントリの UniProt が46万行の RDF/XML になった。。

これを http://bh.dbcls.jp/ の Virtuoso にアップロードした。

サンプルデータでは全101 predicates http://www.uniprot.org/uniprot/#{id}.n4 で表示されるリストにweb版UniProtの項目を対応付け

外部データをたどるための subject predicate のリストアップ

<http://purl.uniprot.org/taxonomy/9606> <http://purl.uniprot.org/core/commonName> 'Homo sapiens'

uniprotに掲載されている各項目にアクセスするためのSPARQL:uniprot_sparql

明日以降は、これを使って元データ esi_sample.txt に UniProt の RDF から抽出したカラムを追加するシステムを開発する。

Gene Ontology

GO のページから、

 RDF-XML Filtered ontology	 Daily	rdf-xml.gz

にリンクされている http://archive.geneontology.org/latest-termdb/go_daily-termdb.rdf-xml.gz をダウンロードし、bh の Virtuoso にアップロードしたが

 You have attempted to upload invalid data. You can only upload RDF, Turtle, N3 serializations of RDF Data to the RDF Data Store.

といわれた。。46MB のファイルだが validation をするにはどうしたらよいのか。W3Cのウェブ版のバリデータはファイルアップロードがないので、とりあえず http://kanehisa.hgc.jp/~k/tmp/go_daily-termdb.rdf-xml に置いて Check by URI で検証を試みたが

 504 Gateway Time-out
 The server didn't respond in time.

となってしまった。仕方ないので raptor をインストールし、変換できるかどうかで検証してみた。

 % rapper -i rdfxml -o ntriples go_daily-termdb.rdf-xml 
 rapper: Parsing URI file:///Users/bh11/Public/go/go_daily-termdb.rdf-xml with parser rdfxml
 rapper: Serializing with serializer ntriples
 _:genid1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.geneontology.org/dtds/go.dtd#go> .
 rapper: Error - URI file:///Users/bh11/Public/go/go_daily-termdb.rdf-xml:5 - rdf:RDF is forbidden as a property element.
 rapper: Failed to parse file go_daily-termdb.rdf-xml rdfxml content
 rapper: Parsing returned 1 triple

パースできないようだ。加藤さんに教えていただいたところ、先頭の

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE go:go PUBLIC "-//Gene Ontology//Custom XML/RDF Version 2.0//EN" "http://www.geneontology.org/dtd/go.dtd">
 
 <go:go xmlns:go="http://www.geneontology.org/dtds/go.dtd#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
     <rdf:RDF>
         <go:term rdf:about="http://www.geneontology.org/go#GO:0000001">
             <go:accession>GO:0000001</go:accession>

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE go:go PUBLIC "-//Gene Ontology//Custom XML/RDF Version 2.0//EN" "http://www.geneontology.org/dtd/go.dtd">
 
     <rdf:RDF xmlns:go="http://www.geneontology.org/dtds/go.dtd#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
         <go:term rdf:about="http://www.geneontology.org/go#GO:0000001">
             <go:accession>GO:0000001</go:accession>

と変更すれば大丈夫とのこと。go:go ってなんだー?

しかし、このファイルも、ntriples に変換したファイルも Virtuoso に入れようとすると認識されない部分があるようだ:

 You have attempted to upload invalid data. You can only upload RDF, Turtle, N3 serializations of RDF Data to the RDF Data Store.

http://www.geneontology.org/GO.downloads.ontology.shtml では、

  • RDF-XML Filtered ontology Daily rdf-xml.gz
  • OWL Filtered ontology Daily owl.gz

の2種類が配られており、GO 0000001 は

RDF-XML では

       <go:term rdf:about="http://www.geneontology.org/go#GO:0000001">
           <go:accession>GO:0000001</go:accession>
           <go:name>mitochondrion inheritance</go:name>
           <go:synonym>mitochondrial inheritance</go:synonym>
           <go:definition>The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, mediated by interactions between mitochondria and the cytoskeleton.</go:definition>
           <go:is_a rdf:resource="http://www.geneontology.org/go#GO:0048308" />
           <go:is_a rdf:resource="http://www.geneontology.org/go#GO:0048311" />
       </go:term>

OWL では

   <owl:Class rdf:about="http://purl.obolibrary.org/obo/GO_0000001">
       <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">mitochondrion inheritance</rdfs:label>
       <rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/GO_0048308"/>
       <rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/GO_0048311"/>
       <oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">GO:0000001</oboInOwl:id>
       <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, mediated by interactions between mitochondria and the cytoskeleton.</obo:IAO_0000115>
       <oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">biological_process</oboInOwl:hasOBONamespace>
       <oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">mitochondrial inheritance</oboInOwl:hasExactSynonym>
   </owl:Class>
   <owl:Axiom>
       <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">GOC:mcc</oboInOwl:hasDbXref>
       <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">PMID:10873824</oboInOwl:hasDbXref>
       <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">PMID:11389764</oboInOwl:hasDbXref>
       <owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, mediated by interactions between mitochondria and the cytoskeleton.</owl:annotatedTarget>
       <owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/GO_0000001"/>
       <owl:annotatedProperty rdf:resource="http://purl.obolibrary.org/obo/IAO_0000115"/>
   </owl:Axiom>

と記述されている。

http://www.obofoundry.org/ の方では

  • Biological process
  • Cellular component
  • Molecular function

について共通のリンク先があり、

のように(さらに別のサイトに転送された上で)ダウンロードできるデータが置いてあるが、

   <owl:Class rdf:about="http://purl.obolibrary.org/obo/GO_0000001">
       <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">mitochondrion inheritance</rdfs:label>
       <rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/GO_0048308"/>
       <rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/GO_0048311"/>
       <oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">GO:0000001</oboInOwl:id>
       <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, mediated by interactions between mitochondria and the cytoskeleton.</obo:IAO_0000115>
       <oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">biological_process</oboInOwl:hasOBONamespace>
       <oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">mitochondrial inheritance</oboInOwl:hasExactSynonym>
   </owl:Class>
   <owl:Axiom>
       <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">GOC:mcc</oboInOwl:hasDbXref>
       <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">PMID:10873824</oboInOwl:hasDbXref>
       <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">PMID:11389764</oboInOwl:hasDbXref>
       <owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, mediated by interactions between mitochondria and the cytoskeleton.</owl:annotatedTarget>
       <owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/GO_0000001"/>
       <owl:annotatedProperty rdf:resource="http://purl.obolibrary.org/obo/IAO_0000115"/>
   </owl:Axiom>

geneontology.org の OWL 版と中身は大体同じようだ(diffをとると結構な量が出てくるが更新頻度の違いかも)。

問題はこれらのファイルのどれも Virtuoso にアップロードするとエラーが出ること。。だれかOWLIMとかほかのトリプルストアでも試してください。。


DDBJ

からRDFファイル取得

  • お昼頃 virtuoso にアップロードしたところ
You have attempted to upload invalid data. You can only upload RDF, Turtle, N3 serializations of RDF Data to the RDF Data Store.
  • 夕方再度アップロードした→成功
  • 同じファイルを再度アップロード→失敗
  • 再度アップロード→成功
  • 謎です
  • http://localhost:8890/DAV/ddbj
  • ファイルサイズ85M、100万行、7万3千トリプル

ddbjに掲載されている各項目にアクセスするためのSPARQL:ddbj_sparql



BH11.11 TOP にもどる