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[R]

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

Public Instance Methods

confidence=(conf) click to toggle source

Confidence object

# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 339
def confidence=(conf)
  @confidence = conf
end
duplications=(str) click to toggle source

Integer

# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 344
def duplications=(str)
  @duplications = str.to_i
end
losses=(str) click to toggle source

Integer

# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 349
def losses=(str)
  @losses = str.to_i
end
speciations=(str) click to toggle source

Integer

# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 354
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 368
def to_xml
  #@todo add unit test
  events = LibXML::XML::Node.new('events')
  PhyloXML::Writer.generate_xml(events, self, [
    [:simple, 'type', (defined? @type) ? @type : nil],
    [:simple, 'duplications', (defined? @duplications) ? @duplications : nil],
    [:simple, 'speciations', (defined? @speciations) ? @speciations : nil],
    [:simple, 'losses', (defined? @losses) ? @losses : nil],
    [:complex, 'confidence', (defined? @confidence) ? @confidence : nil]])
  return events
end
type=(str) click to toggle source

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

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