Class: Mspire::OBO

Inherits:
Object
  • Object
show all
Defined in:
lib/mspire/obo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_or_io) ⇒ OBO

Returns a new instance of OBO



7
8
9
10
11
# File 'lib/mspire/obo.rb', line 7

def initialize(file_or_io)
  obo = Obo::Parser.new(file_or_io)
  elements = obo.elements.to_a
  header = elements.shift
end

Instance Attribute Details

#elementsObject

Returns the value of attribute elements



5
6
7
# File 'lib/mspire/obo.rb', line 5

def elements
  @elements
end

#headerObject

Returns the value of attribute header



4
5
6
# File 'lib/mspire/obo.rb', line 4

def header
  @header
end

Instance Method Details

#id_to_elementObject



20
21
22
# File 'lib/mspire/obo.rb', line 20

def id_to_element
  @id_to_element ||= build_hash('id', nil)
end

#id_to_nameObject

returns an id to name Hash



13
14
15
# File 'lib/mspire/obo.rb', line 13

def id_to_name
  @id_to_name ||= build_hash('id', 'name')
end

#name_to_idObject

returns a name to id Hash



17
18
19
# File 'lib/mspire/obo.rb', line 17

def name_to_id
  @name_to_id ||= build_hash('name', 'id')
end