Module: BioVcf::VcfRdf

Defined in:
lib/bio-vcf/vcfrdf.rb

Overview

This is some primarily RDF support - which may be moved to another gem

Note that this functionality is superceded by the –template command! Though this can be useful for one-liners.

Class Method Summary collapse

Class Method Details

.headerObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bio-vcf/vcfrdf.rb', line 10

def VcfRdf::header
  print <<EOB
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix hgnc: <http://identifiers.org/hgnc.symbol/> .
@prefix doi: <http://dx.doi.org/> .
@prefix db: <http://biobeat.org/rdf/db#> .
@prefix seq: <http://biobeat.org/rdf/seq#> .
@prefix : <http://biobeat.org/rdf/vcf#> .
EOB
end

.record(id, rec, tags = "{}") ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/bio-vcf/vcfrdf.rb', line 23

def VcfRdf::record id,rec,tags = "{}"
  id2 = [id,'ch'+rec.chrom,rec.pos,rec.alt.join('')].join('_')
  print <<OUT
:#{id2} seq:chr \"#{rec.chrom}\" .
:#{id2} seq:pos #{rec.pos} .
:#{id2} seq:alt \"#{rec.alt[0]}\" .
:#{id2} db:vcf true .
OUT
  hash = eval(tags)
  if hash
    hash.each do |k,v|
      print ":#{id2} #{k} #{v} .\n"
    end
  end
  print "\n"
end