Class: Bio::NeXML::Node
- Inherits:
-
Tree::Node
- Object
- Tree::Node
- Bio::NeXML::Node
- Includes:
- Mapper
- Defined in:
- lib/bio/db/nexml/trees.rb
Overview
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’.
Constant Summary collapse
Instance Attribute Summary collapse
-
#id ⇒ Object
A file level unique identifier.
-
#label ⇒ Object
A human readable description.
-
#root ⇒ Object
Stores a boolean value to indicate a root node.
Instance Method Summary collapse
-
#initialize(id, options = {}) ⇒ Node
constructor
Create a new otu.
-
#otu ⇒ Object
Return the otu to which the node links to.
-
#root? ⇒ Boolean
Returns true if the node is a root node; false otherwise.
- #to_xml ⇒ Object
Methods included from Mapper
Constructor Details
#initialize(id, options = {}) ⇒ Node
36 37 38 39 40 41 |
# File 'lib/bio/db/nexml/trees.rb', line 36 def initialize( id, = {} ) super( id ) @id = id properties( ) unless .empty? block.arity < 1 ? instance_eval( &block ) : block.call( self ) if block_given? end |
Instance Attribute Details
#id ⇒ Object
A file level unique identifier.
17 18 19 |
# File 'lib/bio/db/nexml/trees.rb', line 17 def id @id end |
#label ⇒ Object
A human readable description.
23 24 25 |
# File 'lib/bio/db/nexml/trees.rb', line 23 def label @label end |
#root ⇒ Object
Stores a boolean value to indicate a root node.
20 21 22 |
# File 'lib/bio/db/nexml/trees.rb', line 20 def root @root end |
Instance Method Details
#otu ⇒ Object
Return the otu to which the node links to.
44 |
# File 'lib/bio/db/nexml/trees.rb', line 44 def otu; end |
#root? ⇒ Boolean
Returns true if the node is a root node; false otherwise.
50 51 52 |
# File 'lib/bio/db/nexml/trees.rb', line 50 def root? root end |
#to_xml ⇒ Object
12 13 14 |
# File 'lib/bio/db/nexml/trees.rb', line 12 def to_xml @@writer.create_node( "node", @@writer.attributes( self, :id, :otu, :root, :label ) ) end |