Class: Bio::PhyloXML::Taxonomy
- Defined in:
- lib/bio/db/phyloxml/phyloxml_elements.rb
Overview
Taxonomy class
Instance Attribute Summary collapse
-
#id_source ⇒ Object
Used to link other elements to a taxonomy (on the xml-level).
-
#other ⇒ Object
Array of Other objects.
-
#taxonomy_id ⇒ Object
String.
-
#uri ⇒ Object
Uri object.
Attributes inherited from Taxonomy
#authority, #code, #common_names, #rank, #scientific_name, #synonyms
Instance Method Summary collapse
-
#initialize ⇒ Taxonomy
constructor
A new instance of Taxonomy.
-
#to_xml ⇒ Object
Converts elements to xml representation.
Constructor Details
#initialize ⇒ Taxonomy
Returns a new instance of Taxonomy.
86 87 88 89 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 86 def initialize super @other = [] end |
Instance Attribute Details
#id_source ⇒ Object
Used to link other elements to a taxonomy (on the xml-level)
78 79 80 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 78 def id_source @id_source end |
#other ⇒ Object
Array of Other objects. Used to save additional information from other than PhyloXML namspace.
84 85 86 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 84 def other @other end |
#taxonomy_id ⇒ Object
String. Unique identifier of a taxon.
76 77 78 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 76 def taxonomy_id @taxonomy_id end |
#uri ⇒ Object
Uri object
80 81 82 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 80 def uri @uri end |
Instance Method Details
#to_xml ⇒ Object
Converts elements to xml representation. Called by PhyloXML::Writer class.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 92 def to_xml taxonomy = LibXML::XML::Node.new('taxonomy') taxonomy["type"] = @type if @type != nil taxonomy["id_source"] = @id_source if @id_source != nil PhyloXML::Writer.generate_xml(taxonomy, self, [[:complex, 'id', @taxonomy_id], [:pattern, 'code', @code, Regexp.new("^[a-zA-Z0-9_]{2,10}$")], [:simple, 'scientific_name', @scientific_name], [:simple, 'authority', @authority], [:simplearr, 'common_name', @common_names], [:simplearr, 'synonym', @synonyms], [:simple, 'rank', @rank], [:complex, 'uri',@uri]]) #@todo anything else return taxonomy end |