Class: Bio::PhyloXML::Distribution

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/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.



406
407
408
409
# File 'lib/bio/phyloxml/elements.rb', line 406

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

Instance Attribute Details

#descObject

String. Free text description of location.



400
401
402
# File 'lib/bio/phyloxml/elements.rb', line 400

def desc
  @desc
end

#pointsObject

Array of Point objects. Holds coordinates of the location.



402
403
404
# File 'lib/bio/phyloxml/elements.rb', line 402

def points
  @points
end

#polygonsObject

Array of Polygon objects.



404
405
406
# File 'lib/bio/phyloxml/elements.rb', line 404

def polygons
  @polygons
end

Instance Method Details

#to_xmlObject

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



413
414
415
416
417
418
419
420
# File 'lib/bio/phyloxml/elements.rb', line 413

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