Class: Bio::NeXML::Network

Inherits:
Tree
  • Object
show all
Defined in:
lib/bio/db/nexml/trees.rb

Direct Known Subclasses

FloatNetwork, IntNetwork

Constant Summary collapse

@@writer =
Bio::NeXML::Writer.new

Instance Attribute Summary

Attributes inherited from Tree

#id, #label, #rootedge

Instance Method Summary collapse

Methods inherited from Tree

#<<, #[], #__add_edge__, #__add_node__, #add_edge, #add_node, #add_rootedge, #ancestors, #children, #create_edge, #create_node, #create_rootedge, #descendents, #each_node, #get_edge_by_id, #get_node_by_id, #has_edge?, #has_node?, #include?, #lowest_common_ancestor, #parent, #remove_edge, #remove_node, #roots

Methods included from Mapper

#properties

Constructor Details

#initialize(id, options = {}, &block) ⇒ Network

Returns a new instance of Network.



478
479
480
# File 'lib/bio/db/nexml/trees.rb', line 478

def initialize( id, options = {}, &block )
  super
end

Instance Method Details

#to_xmlObject



482
483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/bio/db/nexml/trees.rb', line 482

def to_xml
  node = @@writer.create_node( "network", @@writer.attributes( self, :id, :'xsi:type', :label ) )

  self.each_node do |n|
    node << n.to_xml
  end

  self.each_edge do |edge|
    node << edge.to_xml
  end

  node
end