Class: Bio::PhyloXML::Taxonomy
- Defined in:
- lib/bio/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.
78 79 80 81 |
# File 'lib/bio/phyloxml/elements.rb', line 78 def initialize super @other = [] end |
Instance Attribute Details
#id_source ⇒ Object
Used to link other elements to a taxonomy (on the xml-level)
70 71 72 |
# File 'lib/bio/phyloxml/elements.rb', line 70 def id_source @id_source end |
#other ⇒ Object
Array of Other objects. Used to save additional information from other than PhyloXML namspace.
76 77 78 |
# File 'lib/bio/phyloxml/elements.rb', line 76 def other @other end |
#taxonomy_id ⇒ Object
String. Unique identifier of a taxon.
68 69 70 |
# File 'lib/bio/phyloxml/elements.rb', line 68 def taxonomy_id @taxonomy_id end |
#uri ⇒ Object
Uri object
72 73 74 |
# File 'lib/bio/phyloxml/elements.rb', line 72 def uri @uri end |
Instance Method Details
#to_xml ⇒ Object
Converts elements to xml representation. Called by PhyloXML::Writer class.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/bio/phyloxml/elements.rb', line 84 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 |