class Bio::PhyloXML::Events

Description

Events at the root node of a clade (e.g. one gene duplication).

Attributes

confidence[R]

Confidence object

duplications[R]

Integer

losses[R]

Integer

speciations[R]

Integer

type[RW]

value comes from list: transfer, fusion, speciation_or_duplication, other, mixed, unassigned

Public Instance Methods

confidence=(type, value) click to toggle source
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 333
def confidence=(type, value)
  @confidence = Confidence.new(type, value)
end
duplications=(str) click to toggle source
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 341
def duplications=(str)
  @duplications = str.to_i
end
losses=(str) click to toggle source
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 345
def losses=(str)
  @losses = str.to_i
end
speciations=(str) click to toggle source
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 349
def speciations=(str)
  @speciations=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 362
def to_xml
  #@todo add unit test
  events = LibXML::XML::Node.new('events')
  PhyloXML::Writer.generate_xml(events, self, [
    [:simple, 'type', @type],
    [:simple, 'duplications', @duplications],
    [:simple, 'speciations', @speciations],
    [:simple, 'losses', @losses],
    [:complex, 'confidence', @confidence]])
  return events
end
type=(str) click to toggle source
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 353
def type=(str)
  @type = str
  #@todo add unit test for this
  if not ['transfer','fusion','speciation_or_duplication','other','mixed', 'unassigned'].include?(str)
    raise "Warning #{str} is not one of the allowed values"
  end
end