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