Class Bio::Tree::Edge
In: lib/bio/tree.rb
Parent: Object

Edge object of each node. By default, the object doesn‘t contain any node information.

Methods

Attributes

distance  [R]  evolutionary distance
distance_string  [R]  evolutionary distance represented as a string
log_likelihood  [RW]  log likelihood value (:L in NHX)
width  [RW]  width of the edge (<branch width="w"> of PhyloXML, or :W="w" in NHX)

Public Class methods

creates a new edge.

[Source]

    # File lib/bio/tree.rb, line 32
32:       def initialize(distance = nil)
33:         if distance.kind_of?(Numeric)
34:           self.distance = distance
35:         elsif distance
36:           self.distance_string = distance
37:         end
38:       end

Public Instance methods

set evolutionary distance value

[Source]

    # File lib/bio/tree.rb, line 47
47:       def distance=(num)
48:         @distance = num
49:         @distance_string = (num ? num.to_s : num)
50:       end

set evolutionary distance value from a string

[Source]

    # File lib/bio/tree.rb, line 53
53:       def distance_string=(str)
54:         if str.to_s.strip.empty?
55:           @distance = nil
56:           @distance_string = str
57:         else
58:           @distance = str.to_f
59:           @distance_string = str
60:         end
61:       end

visualization of this object

[Source]

    # File lib/bio/tree.rb, line 64
64:       def inspect
65:         "<Edge distance=#{@distance.inspect}>"
66:       end

Other NHX parameters. Returns a Hash. Note that :L and :W are not stored here but stored in the proper attributes in this class. However, if you force to set these parameters in this hash, the parameters in this hash are preferred when generating NHX. In addition, If the same parameters are defined at Node object, the parameters in the node are preferred.

[Source]

    # File lib/bio/tree.rb, line 91
91:       def nhx_parameters
92:         @nhx_parameters ||= {}
93:         @nhx_parameters
94:       end

string representation of this object

[Source]

    # File lib/bio/tree.rb, line 69
69:       def to_s
70:         @distance_string.to_s
71:       end

[Validate]