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 "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n@prefix dc: <http://purl.org/dc/elements/1.1/> .\n@prefix hgnc: <http://identifiers.org/hgnc.symbol/> .\n@prefix doi: <http://dx.doi.org/> .\n@prefix db: <http://biobeat.org/rdf/db#> .\n@prefix seq: <http://biobeat.org/rdf/seq#> .\n@prefix : <http://biobeat.org/rdf/vcf#> .\n"
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 ":\#{id2} seq:chr \\\"\#{rec.chrom}\\\" .\n:\#{id2} seq:pos \#{rec.pos} .\n:\#{id2} seq:alt \\\"\#{rec.alt[0]}\\\" .\n:\#{id2} db:vcf true .\n"
  hash = eval(tags)
  if hash
    hash.each do |k,v|
      print ":#{id2} #{k} #{v} .\n"
    end
  end
  print "\n"
end