Class: Obo::Ontology
- Inherits:
-
Object
- Object
- Obo::Ontology
- Defined in:
- lib/obo/ontology.rb
Constant Summary
- DIR =
File.(File.dirname(__FILE__) + '/../../obo')
Instance Attribute Summary (collapse)
-
- (Object) elements
Returns the value of attribute elements.
-
- (Object) header
Returns the value of attribute header.
Instance Method Summary (collapse)
- - (Object) id_to_cast
- - (Object) id_to_element
-
- (Object) id_to_name
returns an id to name Hash.
-
- (Ontology) initialize(file_or_io)
constructor
A new instance of Ontology.
-
- (Object) name_to_id
returns a name to id Hash.
Constructor Details
- (Ontology) initialize(file_or_io)
A new instance of Ontology
39 40 41 42 43 |
# 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 |
Instance Attribute Details
- (Object) elements
Returns the value of attribute elements
37 38 39 |
# File 'lib/obo/ontology.rb', line 37 def elements @elements end |
- (Object) header
Returns the value of attribute header
36 37 38 |
# File 'lib/obo/ontology.rb', line 36 def header @header end |
Instance Method Details
- (Object) id_to_cast
50 51 52 |
# 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 |
- (Object) id_to_element
59 60 61 |
# File 'lib/obo/ontology.rb', line 59 def id_to_element @id_to_element ||= build_hash('id', nil) end |
- (Object) id_to_name
returns an id to name Hash
46 47 48 |
# File 'lib/obo/ontology.rb', line 46 def id_to_name @id_to_name ||= build_hash('id', 'name') end |
- (Object) name_to_id
returns a name to id Hash
55 56 57 |
# File 'lib/obo/ontology.rb', line 55 def name_to_id @name_to_id ||= build_hash('name', 'id') end |