class Obo::Ontology
Constants
- DIR
Attributes
elements[RW]
header[RW]
Public Class Methods
new(file_or_io)
click to toggle source
# File lib/obo/ontology.rb, line 39 def initialize(file_or_io) obo = Obo::Parser.new(file_or_io) @elements = obo.elements.to_a @header = elements.shift end
Public Instance Methods
id_to_cast()
click to toggle source
# File lib/obo/ontology.rb, line 50 def id_to_cast @id_to_cast ||= Hash[ id_to_element.map {|id,el| [id, el.cast_method] } ] end
id_to_element()
click to toggle source
# File lib/obo/ontology.rb, line 59 def id_to_element @id_to_element ||= build_hash('id', nil) end
id_to_name()
click to toggle source
returns an id to name Hash
# File lib/obo/ontology.rb, line 46 def id_to_name @id_to_name ||= build_hash('id', 'name') end
name_to_id()
click to toggle source
returns a name to id Hash
# File lib/obo/ontology.rb, line 55 def name_to_id @name_to_id ||= build_hash('name', 'id') end
Protected Instance Methods
build_hash(key,val)
click to toggle source
# File lib/obo/ontology.rb, line 64 def build_hash(key,val) hash = {} @elements.each do |el| tv = el.tagvalues if val.nil? hash[tv[key].first] = el else hash[tv[key].first] = tv[val].first end end hash end