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.



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

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

Instance Attribute Details

#bootstrapObject

bootstrap value



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

def bootstrap
  @bootstrap
end

#bootstrap_stringObject

bootstrap value as a string



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

def bootstrap_string
  @bootstrap_string
end

#ec_numberObject

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



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

def ec_number
  @ec_number
end

#nameObject

name of the node



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

def name
  @name
end

#order_numberObject

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



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

def order_number
  @order_number
end

#scientific_nameObject

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



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

def scientific_name
  @scientific_name
end

#taxonomy_idObject

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



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

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


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

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

#inspectObject

visualization of this object



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

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.



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

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

#to_sObject

string representation of this object



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

def to_s
  @name.to_s
end