Class: Bio::PhyloXML::Confidence
- Inherits:
-
Object
- Object
- Bio::PhyloXML::Confidence
- Defined in:
- lib/bio-phyloxml/phyloxml_elements.rb
Overview
A general purpose confidence element. For example this can be used to express the bootstrap support value of a clade (in which case the ‘type’ attribute is ‘bootstrap’).
Instance Attribute Summary collapse
-
#type ⇒ Object
String.
-
#value ⇒ Object
Float.
Instance Method Summary collapse
-
#initialize(type, value) ⇒ Confidence
constructor
A new instance of Confidence.
-
#to_xml ⇒ Object
Converts elements to xml representation.
Constructor Details
#initialize(type, value) ⇒ Confidence
Returns a new instance of Confidence.
380 381 382 383 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 380 def initialize(type, value) @type = type @value = value.to_f end |
Instance Attribute Details
#type ⇒ Object
String. The type of confidence measure, for example, bootstrap.
376 377 378 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 376 def type @type end |
#value ⇒ Object
Float. The value of confidence measure.
378 379 380 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 378 def value @value end |
Instance Method Details
#to_xml ⇒ Object
Converts elements to xml representation. Called by PhyloXML::Writer class.
386 387 388 389 390 391 392 393 394 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 386 def to_xml if @type == nil raise "Type is a required attribute for confidence." else confidence = LibXML::XML::Node.new('confidence', @value.to_s) confidence["type"] = @type return confidence end end |