Class: Bio::PhyloXML::BranchColor
- Defined in:
- lib/bio/db/phyloxml/phyloxml_elements.rb
Overview
Description
This indicates the color of a node when rendered (the color applies to the whole node and its children unless overwritten by the color(s) of sub clades).
Instance Attribute Summary collapse
-
#blue ⇒ Object
Integer.
-
#green ⇒ Object
Integer.
-
#red ⇒ Object
Integer.
Instance Method Summary collapse
-
#to_xml ⇒ Object
Converts elements to xml representation.
Instance Attribute Details
#blue ⇒ Object
Integer
752 753 754 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 752 def blue @blue end |
#green ⇒ Object
Integer
752 753 754 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 752 def green @green end |
#red ⇒ Object
Integer
752 753 754 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 752 def red @red end |
Instance Method Details
#to_xml ⇒ Object
Converts elements to xml representation. Called by PhyloXML::Writer class.
767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 767 def to_xml #@todo add unit test if @red == nil raise "Subelement red of BranchColor element should not be nil" elsif @green == nil raise "Subelement green of BranchColor element should not be nil" elsif @blue == nil raise "Subelement blue of BranchColor element should not be nil" end c = LibXML::XML::Node.new('branch_color') PhyloXML::Writer.generate_xml(c, self, [ [:simple, 'red', @red], [:simple, 'green', @green], [:simple, 'blue', @blue]]) return c end |