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.



32
33
34
35
36
37
38
# 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

Instance Attribute Details

#distanceObject

evolutionary distance



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

def distance
  @distance
end

#distance_stringObject

evolutionary distance represented as a string



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

def distance_string
  @distance_string
end

#log_likelihoodObject

log likelihood value (:L in NHX)



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

def log_likelihood
  @log_likelihood
end

#widthObject

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



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

def width
  @width
end

Instance Method Details

#inspectObject

visualization of this object



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

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.



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

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

#to_sObject

string representation of this object



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

def to_s
  @distance_string.to_s
end