class Bio::PhyloXML::BranchColor

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

Attributes

blue[R]

Integer

green[R]

Integer

red[R]

Integer

Public Instance Methods

blue=(str) click to toggle source
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 771
def blue=(str)
  @blue = str.to_i
end
green=(str) click to toggle source
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 767
def green=(str)
  @green = str.to_i
end
red=(str) click to toggle source
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 763
def red=(str)
  @red = str.to_i
end
to_xml() click to toggle source

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

# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 776
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