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

## Description

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

### Methods

confidence= confidence= duplications= losses= speciations= to_xml type=

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

[Source]

         # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 333
    333:     def confidence=(type, value)
    334:       @confidence = Confidence.new(type, value)
    335:     end

confidence=(conf)

[Source]

         # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 337
    337:     def confidence=(conf)
    338:       @confidence = conf
    339:     end

duplications=(str)

[Source]

         # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 341
    341:     def duplications=(str)
    342:       @duplications = str.to_i
    343:     end

losses=(str)

[Source]

         # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 345
    345:     def losses=(str)
    346:       @losses = str.to_i
    347:     end

speciations=(str)

[Source]

         # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 349
    349:     def speciations=(str)
    350:       @speciations=str.to_i
    351:     end

to_xml()

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

[Source]

         # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 362
    362:     def to_xml
    363:       #@todo add unit test
    364:       events = LibXML::XML::Node.new('events')
    365:       PhyloXML::Writer.generate_xml(events, self, [
    366:         [:simple, 'type', @type],
    367:         [:simple, 'duplications', @duplications],
    368:         [:simple, 'speciations', @speciations],
    369:         [:simple, 'losses', @losses],
    370:         [:complex, 'confidence', @confidence]])
    371:       return events
    372:     end

type=(str)

[Source]

         # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 353
    353:     def type=(str)
    354:       @type = str
    355:       #@todo add unit test for this
    356:       if not ['transfer','fusion','speciation_or_duplication','other','mixed', 'unassigned'].include?(str)
    357:         raise "Warning #{str} is not one of the allowed values"
    358:       end
    359:     end

[Validate]