class Bio::Tree::Edge

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

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

new(distance = nil) click to toggle source

creates a new edge.

# File lib/bio/tree.rb, line 32
def initialize(distance = nil)
  if distance.kind_of?(Numeric)
    self.distance = distance
  elsif distance
    self.distance_string = distance
  end
end

Public Instance Methods

distance=(num) click to toggle source

set evolutionary distance value

# File lib/bio/tree.rb, line 47
def distance=(num)
  @distance = num
  @distance_string = (num ? num.to_s : num)
end
distance_string=(str) click to toggle source

set evolutionary distance value from a string

# File lib/bio/tree.rb, line 53
def distance_string=(str)
  if str.to_s.strip.empty?
    @distance = nil
    @distance_string = str
  else
    @distance = str.to_f
    @distance_string = str
  end
end
inspect() click to toggle source

visualization of this object

# File lib/bio/tree.rb, line 64
def inspect
  "<Edge distance=#{@distance.inspect}>"
end
nhx_parameters() click to toggle source

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.

# File lib/bio/tree.rb, line 91
def nhx_parameters
  @nhx_parameters ||= {}
  @nhx_parameters
end
to_s() click to toggle source

string representation of this object

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