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

#initialize(distance = nil) ⇒ Edge

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

#distanceObject

evolutionary distance



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

def distance
  @distance
end

#distance_stringObject

evolutionary distance represented as a string



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

def distance_string
  @distance_string
end

#log_likelihoodObject

log likelihood value (:L in NHX)



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

def log_likelihood
  @log_likelihood
end

#widthObject

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

#inspectObject

visualization of this object



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

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

#nhx_parametersObject

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

#to_sObject

string representation of this object



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

def to_s
  @distance_string.to_s
end