class BioDSL::Taxonomy::Index::TaxNode
Class for the nodes used for constructing the taxonomic tree.
Attributes
children[R]
kmers[RW]
level[R]
name[R]
node_id[R]
parent[R]
seq_id[R]
Public Class Methods
new(parent, level, name, seq_id, node_id)
click to toggle source
Constructor for TaxNode
objects.
# File lib/BioDSL/taxonomy.rb, line 258 def initialize(parent, level, name, seq_id, node_id) @parent = parent # Parent node. @level = level # Taxonomic level. @name = name # Taxonomic name. @kmers = Set.new # Kmer set. @seq_id = seq_id # Sequ id (a representative seq for debugging). @node_id = node_id # Node id. @children = {} # Child node hash. end
Public Instance Methods
[](key)
click to toggle source
Getter method for node children.
# File lib/BioDSL/taxonomy.rb, line 283 def [](key) @children[key] end
[]=(key, value)
click to toggle source
Setter method for node children.
# File lib/BioDSL/taxonomy.rb, line 288 def []=(key, value) @children[key] = value end
children_ids()
click to toggle source
Returns an array of children node ids.
# File lib/BioDSL/taxonomy.rb, line 274 def children_ids ids = [] @children.each_value { |child| ids << child.id } ids end
parent_id()
click to toggle source
Returns parent node id if a parent exist, else nil.
# File lib/BioDSL/taxonomy.rb, line 269 def parent_id @parent.node_id if @parent end