Class: Bio::Tree::Edge

Inherits:
Object show all
Defined in:
lib/bio/tree.rb

Overview

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Edge) initialize(distance = nil)

creates a new edge.



33
34
35
36
37
38
39
# File 'lib/bio/tree.rb', line 33

def initialize(distance = nil)
  if distance.kind_of?(Numeric)
    self.distance = distance
  elsif distance
    self.distance_string = distance
  end
end

Instance Attribute Details

- (Object) distance

evolutionary distance



42
43
44
# File 'lib/bio/tree.rb', line 42

def distance
  @distance
end

- (Object) distance_string

evolutionary distance represented as a string



45
46
47
# File 'lib/bio/tree.rb', line 45

def distance_string
  @distance_string
end

- (Object) log_likelihood

log likelihood value (:L in NHX)



79
80
81
# File 'lib/bio/tree.rb', line 79

def log_likelihood
  @log_likelihood
end

- (Object) width

width of the edge (<branch width=“w”> of PhyloXML, or :W=“w” in NHX)



83
84
85
# File 'lib/bio/tree.rb', line 83

def width
  @width
end

Instance Method Details

- (Object) inspect

visualization of this object



65
66
67
# File 'lib/bio/tree.rb', line 65

def inspect
  "<Edge distance=#{@distance.inspect}>"
end

- (Object) nhx_parameters

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.



92
93
94
95
# File 'lib/bio/tree.rb', line 92

def nhx_parameters
  @nhx_parameters ||= {}
  @nhx_parameters
end

- (Object) to_s

string representation of this object



70
71
72
# File 'lib/bio/tree.rb', line 70

def to_s
  @distance_string.to_s
end