Class: Bio::Tree::Node

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

Overview

Node object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil) ⇒ Node

Creates a new node.


140
141
142
# File 'lib/bio/tree.rb', line 140

def initialize(name = nil)
  @name = name if name
end

Instance Attribute Details

#bootstrapObject

bootstrap value


148
149
150
# File 'lib/bio/tree.rb', line 148

def bootstrap
  @bootstrap
end

#bootstrap_stringObject

bootstrap value as a string


151
152
153
# File 'lib/bio/tree.rb', line 151

def bootstrap_string
  @bootstrap_string
end

#ec_numberObject

EC number (EC_number in PhyloXML, or :E in NHX)


209
210
211
# File 'lib/bio/tree.rb', line 209

def ec_number
  @ec_number
end

#nameObject

name of the node


145
146
147
# File 'lib/bio/tree.rb', line 145

def name
  @name
end

#order_numberObject

the order of the node (lower value, high priority)


193
194
195
# File 'lib/bio/tree.rb', line 193

def order_number
  @order_number
end

#scientific_nameObject

scientific name (scientific_name in PhyloXML, or :S in NHX)


212
213
214
# File 'lib/bio/tree.rb', line 212

def scientific_name
  @scientific_name
end

#taxonomy_idObject

taxonomy identifier (taxonomy_identifier in PhyloXML, or :T in NHX)


215
216
217
# File 'lib/bio/tree.rb', line 215

def taxonomy_id
  @taxonomy_id
end

Instance Method Details

#eventsObject

Phylogenetic events. Returns an Array of one (or more?) of the following symbols

:gene_duplication
:speciation

203
204
205
206
# File 'lib/bio/tree.rb', line 203

def events
  @events ||= []
  @events
end

#inspectObject

visualization of this object


173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/bio/tree.rb', line 173

def inspect
  if @name and !@name.empty? then
    str = "(Node:#{@name.inspect}"
  else
    str = sprintf('(Node:%x', (self.__id__ << 1) & 0xffffffff)
  end
  if defined?(@bootstrap) and @bootstrap then
    str += " bootstrap=#{@bootstrap.inspect}"
  end
  str += ")"
  str
end

#nhx_parametersObject

Other NHX parameters. Returns a Hash. Note that :D, :E, :S, and :T 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.


222
223
224
225
# File 'lib/bio/tree.rb', line 222

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

#to_sObject

string representation of this object


187
188
189
# File 'lib/bio/tree.rb', line 187

def to_s
  @name.to_s
end