Class: Bio::NeXML::Edge
- Inherits:
- 
      Tree::Edge
      
        - Object
- Tree::Edge
- Bio::NeXML::Edge
 
- Includes:
- Mapper
- Defined in:
- lib/bio/db/nexml/trees.rb
Overview
Edge connect two nodes of a tree or a network. An edge should have a unique id. It should have a ‘source’ and a ‘target’ node and optionally a ‘length’ may be assigned to it.
Constant Summary collapse
Instance Attribute Summary collapse
- 
  
    
      #id  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    A file level unique identifier. 
- 
  
    
      #label  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    A human readable description. 
- 
  
    
      #source  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Source of the edge. 
- 
  
    
      #target  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Target of the edge. 
Instance Method Summary collapse
- 
  
    
      #initialize(id, options = {})  ⇒ Edge 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    Create a new edge. 
- 
  
    
      #length  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Return the length of an edge. 
- 
  
    
      #length=(length)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Set the length of an edge. 
- #to_xml ⇒ Object
Methods included from Mapper
Constructor Details
#initialize(id, options = {}) ⇒ Edge
| 84 85 86 87 88 89 | # File 'lib/bio/db/nexml/trees.rb', line 84 def initialize( id, = {} ) super( length ) @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.
| 66 67 68 | # File 'lib/bio/db/nexml/trees.rb', line 66 def id @id end | 
#label ⇒ Object
A human readable description.
| 75 76 77 | # File 'lib/bio/db/nexml/trees.rb', line 75 def label @label end | 
#source ⇒ Object
Source of the edge.
| 69 70 71 | # File 'lib/bio/db/nexml/trees.rb', line 69 def source @source end | 
#target ⇒ Object
Target of the edge.
| 72 73 74 | # File 'lib/bio/db/nexml/trees.rb', line 72 def target @target end | 
Instance Method Details
#length ⇒ Object
Return the length of an edge.
| 92 93 94 | # File 'lib/bio/db/nexml/trees.rb', line 92 def length distance end | 
#length=(length) ⇒ Object
Set the length of an edge.
| 97 98 99 | # File 'lib/bio/db/nexml/trees.rb', line 97 def length=( length ) self.distance = length end | 
#to_xml ⇒ Object
| 61 62 63 | # File 'lib/bio/db/nexml/trees.rb', line 61 def to_xml @@writer.create_node( "edge", @@writer.attributes( self, :id, :source, :target, :length, :label ) ) end |