SPARQLthon65/ClinVar JSON-LD

提供:TogoWiki

(版間での差分)
移動: 案内, 検索
(ページの作成:「最新版 ClinVar の XML から JSON-LD を作れないか検討 ftp://ftp.ncbi.nlm.nih.gov/pub/clinvar/xml/clinvar_variation/beta/ * variation_archive_20180125.xsd * v...」)
19行: 19行:
puts JSON.pretty_generate(JSON.parse(json))
puts JSON.pretty_generate(JSON.parse(json))
</pre>
</pre>
 +
 +
元 XML
 +
 +
<pre>
 +
<VariationArchive Accession="VCV000001978" DateCreated="2010-12-01" DateLastUpdated="2017-09-22" NumberOfSubmissions="1" NumberOfSubmitters="1" RecordType="inte
 +
rpreted" VariationID="1978" VariationName="ADA, IVS5DS, G-A, +1" VariationType="single nucleotide variant" Version="1">
 +
  <RecordStatus>current</RecordStatus>
 +
  <Species>Homo sapiens</Species>
 +
  <InterpretedRecord>
 +
    <SimpleAllele AlleleID="17017" VariationID="1978">
 +
      <GeneList>
 +
        <Gene FullName="adenosine deaminase" GeneID="100" HGNC_ID="HGNC:186" RelationshipType="asserted, but not computed" Source="submitted" Symbol="ADA">
 +
  :
 +
</pre>
 +
 +
JSON
 +
 +
<pre>
 +
{
 +
  "VariationArchive": {
 +
    "Accession": "VCV000001978",
 +
    "DateCreated": "2010-12-01",
 +
    "DateLastUpdated": "2017-09-22",
 +
    "NumberOfSubmissions": "1",
 +
    "NumberOfSubmitters": "1",
 +
    "RecordType": "interpreted",
 +
    "VariationID": "1978",
 +
    "VariationName": "ADA, IVS5DS, G-A, +1",
 +
    "VariationType": "single nucleotide variant",
 +
    "Version": "1",
 +
    "RecordStatus": "current",
 +
    "Species": "Homo sapiens",
 +
    "InterpretedRecord": {
 +
      "SimpleAllele": {
 +
        "AlleleID": "17017",
 +
        "VariationID": "1978",
 +
        "GeneList": {
 +
          "Gene": {
 +
            "FullName": "adenosine deaminase",
 +
            "GeneID": "100",
 +
            "HGNC_ID": "HGNC:186",
 +
            "RelationshipType": "asserted, but not computed",
 +
            "Source": "submitted",
 +
            "Symbol": "ADA",
 +
  :
 +
</pre>
 +
 +
これに JSON-LD 用の変更を追加
 +
 +
<pre>
 +
{
 +
  "@context": "http://med2rdf.org/context/clinvar.jsonld",
 +
  "@id": "http://identifiers.org/clinvar/1978",
 +
  "@type": "cvo:Variation",
 +
  :
 +
</pre>
 +
 +
ここで clinvar.jsonld に色々定義を追加

2018年2月16日 (金) 04:23時点における版

最新版 ClinVar の XML から JSON-LD を作れないか検討

ftp://ftp.ncbi.nlm.nih.gov/pub/clinvar/xml/clinvar_variation/beta/

  • variation_archive_20180125.xsd
  • variation_archive_20180125.xml.gz

XSD と ClinVar オントロジーの対応を検証

XML から JSON へ

require 'active_support'
require 'active_support/core_ext'

json = Hash.from_xml(ARGF.read).to_json
puts JSON.pretty_generate(JSON.parse(json))

元 XML

<VariationArchive Accession="VCV000001978" DateCreated="2010-12-01" DateLastUpdated="2017-09-22" NumberOfSubmissions="1" NumberOfSubmitters="1" RecordType="inte
rpreted" VariationID="1978" VariationName="ADA, IVS5DS, G-A, +1" VariationType="single nucleotide variant" Version="1">
  <RecordStatus>current</RecordStatus>
  <Species>Homo sapiens</Species>
  <InterpretedRecord>
    <SimpleAllele AlleleID="17017" VariationID="1978">
      <GeneList>
        <Gene FullName="adenosine deaminase" GeneID="100" HGNC_ID="HGNC:186" RelationshipType="asserted, but not computed" Source="submitted" Symbol="ADA">
  :

JSON

{
  "VariationArchive": {
    "Accession": "VCV000001978",
    "DateCreated": "2010-12-01",
    "DateLastUpdated": "2017-09-22",
    "NumberOfSubmissions": "1",
    "NumberOfSubmitters": "1",
    "RecordType": "interpreted",
    "VariationID": "1978",
    "VariationName": "ADA, IVS5DS, G-A, +1",
    "VariationType": "single nucleotide variant",
    "Version": "1",
    "RecordStatus": "current",
    "Species": "Homo sapiens",
    "InterpretedRecord": {
      "SimpleAllele": {
        "AlleleID": "17017",
        "VariationID": "1978",
        "GeneList": {
          "Gene": {
            "FullName": "adenosine deaminase",
            "GeneID": "100",
            "HGNC_ID": "HGNC:186",
            "RelationshipType": "asserted, but not computed",
            "Source": "submitted",
            "Symbol": "ADA",
  :

これに JSON-LD 用の変更を追加

{
  "@context": "http://med2rdf.org/context/clinvar.jsonld",
  "@id": "http://identifiers.org/clinvar/1978",
  "@type": "cvo:Variation",
  :

ここで clinvar.jsonld に色々定義を追加

個人用ツール