class Bio::Velvet::Graph::NodeArray

A container class for a list of Node objects. Can index with 1-offset IDs, so that they line up with the identifiers in velvet Graph files, yet respond sensibly to NodeArray#length, etc.

Public Class Methods

new() click to toggle source
# File lib/bio-velvet/graph.rb, line 280
def initialize
  # Internal index is required because when things get deleted stuff changes.
  @internal_structure = {}
end

Public Instance Methods

[](node_id) click to toggle source
# File lib/bio-velvet/graph.rb, line 289
def [](node_id)
  @internal_structure[node_id]
end
[]=(node_id, value) click to toggle source
# File lib/bio-velvet/graph.rb, line 285
def []=(node_id, value)
  @internal_structure[node_id] = value
end
delete(node) click to toggle source
# File lib/bio-velvet/graph.rb, line 293
def delete(node)
  @internal_structure.delete node.node_id
end
each(&block) click to toggle source
# File lib/bio-velvet/graph.rb, line 301
def each(&block)
  @internal_structure.each do |internal_id, node|
    block.yield node
  end
end
length() click to toggle source
# File lib/bio-velvet/graph.rb, line 297
def length
  @internal_structure.length
end