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/phyloxml/elements.rb, line 78
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/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