Class: Bio::PhyloXML::Distribution

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/db/phyloxml/phyloxml_elements.rb

Overview

Description

The geographic distribution of the items of a clade (species, sequences), intended for phylogeographic applications.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDistribution

Returns a new instance of Distribution.



420
421
422
423
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 420

def initialize
  @points = []
  @polygons = []
end

Instance Attribute Details

#descObject

String. Free text description of location.



414
415
416
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 414

def desc
  @desc
end

#pointsObject

Array of Point objects. Holds coordinates of the location.



416
417
418
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 416

def points
  @points
end

#polygonsObject

Array of Polygon objects.



418
419
420
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 418

def polygons
  @polygons
end

Instance Method Details

#to_xmlObject

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



427
428
429
430
431
432
433
434
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 427

def to_xml
  distr = LibXML::XML::Node.new('distribution')
  PhyloXML::Writer.generate_xml(distr, self, [
      [:simple, 'desc', @desc],
      [:objarr, 'point', 'points'],
      [:objarr, 'polygon', 'polygons']])
  return distr
end