class Bio::NeXML::Node

Node represents a node of a Tree or a Network. A node must have a unique id. It may optionally have a human readable ‘label’ and may link to an ‘otu’.

Attributes

id[RW]

A file level unique identifier.

label[RW]

A human readable description.

root[RW]

Stores a boolean value to indicate a root node.

Public Class Methods

new( id, options = {} ) click to toggle source

Create a new otu. Passing an ‘id’ is a must. While ‘label’ and ‘otu’ may be passed as an optional hash.

node = Bio::NeXML::Node.new( 'node1' )
node = Bio::NeXML::Node.new( 'node1', :label => 'A node' )
node = Bio::NeXML::Node.new( 'node1', :label => 'A node', :otu => otu )
Calls superclass method
# File lib/bio/db/nexml/trees.rb, line 36
def initialize( id, options = {} )
  super( id )
  @id = id
  properties( options ) unless options.empty?
  block.arity < 1 ? instance_eval( &block ) : block.call( self ) if block_given?
end

Public Instance Methods

otu() click to toggle source

Return the otu to which the node links to.

# File lib/bio/db/nexml/trees.rb, line 44
def otu; end
otu=( otu ) click to toggle source

Link the node to the given otu.

# File lib/bio/db/nexml/trees.rb, line 47
def otu=( otu ); end
root?() click to toggle source

Returns true if the node is a root node; false otherwise.

# File lib/bio/db/nexml/trees.rb, line 50
def root?
  root
end
to_xml() click to toggle source
# File lib/bio/db/nexml/trees.rb, line 12
def to_xml
  @@writer.create_node( "node", @@writer.attributes( self, :id, :otu, :root, :label ) )
end