Class: Bio::PhyloXML::Events

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/db/phyloxml/phyloxml_elements.rb

Overview

Description

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#confidenceObject

Confidence object



330
331
332
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 330

def confidence
  @confidence
end

#duplicationsObject

Integer



327
328
329
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 327

def duplications
  @duplications
end

#lossesObject

Integer



327
328
329
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 327

def losses
  @losses
end

#speciationsObject

Integer



327
328
329
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 327

def speciations
  @speciations
end

#typeObject

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



324
325
326
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 324

def type
  @type
end

Instance Method Details

#to_xmlObject

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



368
369
370
371
372
373
374
375
376
377
378
# 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