class Bio::PhyloXML::Taxonomy

Taxonomy class

Attributes

id_source[RW]

Used to link other elements to a taxonomy (on the xml-level)

other[RW]

Array of Other objects. Used to save additional information from other than PhyloXML namspace.

taxonomy_id[RW]

String. Unique identifier of a taxon.

uri[RW]

Uri object

Public Class Methods

new() click to toggle source
Calls superclass method Bio::Taxonomy.new
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 85
def initialize
  super
  @other = []
end

Public Instance Methods

to_xml() click to toggle source

Converts elements to xml representation. Called by PhyloXML::Writer class.

# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 91
def to_xml
  taxonomy = LibXML::XML::Node.new('taxonomy')
  taxonomy["type"] = @type if (defined? @type) && @type
  taxonomy["id_source"] = @id_source if (defined? @id_source) && @id_source

  PhyloXML::Writer.generate_xml(taxonomy, self, [[:complex, 'id', (defined? @taxonomy_id) ? @taxonomy_id : nil],
    [:pattern, 'code', (defined? @code) ? @code : nil, Regexp.new("^[a-zA-Z0-9_]{2,10}$")],
    [:simple, 'scientific_name', (defined? @scientific_name) ? @scientific_name : nil],
    [:simple, 'authority', (defined? @authority) ? @authority : nil],
    [:simplearr, 'common_name', (defined? @common_names) ? @common_names : nil],
    [:simplearr, 'synonym', (defined? @synonyms) ? @synonyms : nil],
    [:simple, 'rank', (defined? @rank) ? @rank : nil],
    [:complex, 'uri',(defined? @uri) ? @uri : nil]])
    #@todo anything else


  return taxonomy
end