Class Bio::PhyloXML::BranchColor
In: lib/bio/db/phyloxml/phyloxml_elements.rb
Parent: Object

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).

Methods

blue=   green=   red=   to_xml  

Attributes

blue  [R]  Integer
green  [R]  Integer
red  [R]  Integer

Public Instance methods

[Source]

     # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 762
762:       def blue=(str)
763:         @blue = str.to_i
764:       end

[Source]

     # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 758
758:       def green=(str)
759:         @green = str.to_i
760:       end

[Source]

     # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 754
754:       def red=(str)
755:         @red = str.to_i
756:       end

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

[Source]

     # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 767
767:       def to_xml
768:         #@todo add unit test
769:         if @red == nil
770:           raise "Subelement red of BranchColor element should not be nil"
771:         elsif @green == nil
772:           raise "Subelement green of BranchColor element should not be nil"
773:         elsif @blue == nil
774:           raise "Subelement blue of BranchColor element should not be nil"
775:         end
776: 
777:         c = LibXML::XML::Node.new('branch_color')
778:         PhyloXML::Writer.generate_xml(c, self, [
779:             [:simple, 'red', @red],
780:             [:simple, 'green', @green],
781:             [:simple, 'blue', @blue]])
782:         return c
783:       end

[Validate]