Class: Bio::NeXML::Otu
- Inherits:
-
Object
- Object
- Bio::NeXML::Otu
- Includes:
- Mapper
- Defined in:
- lib/bio/db/nexml/taxa.rb
Overview
DESCRIPTION
Otu represents a taxon; an implementation of the Taxon type. An Otu must have an 'id' and may take an an optional 'label'.
taxon1 = Bio::NeXML::Otu.new( 'taxon1', :label => 'Label for taxon1' )
taxon1.id #=> 'taxon1'
taxon1.label #=> 'Label for taxon1'
taxon1.otus #=> otus object they belong to; see docs for Otus
Constant Summary
- @@writer =
Bio::NeXML::Writer.new
Instance Attribute Summary (collapse)
-
- (Object) id
A file level unique identifier.
-
- (Object) label
A human readable description.
Instance Method Summary (collapse)
-
- (Otu) initialize(id, options = {}, &block)
constructor
Create a new otu.
- - (Object) to_xml
Methods included from Mapper
Constructor Details
- (Otu) initialize(id, options = {}, &block)
Create a new otu.
otu = Bio::NeXML::Otu.id( 'o1' )
otu = Bio::NeXML::Otu.id( 'o1', :label => 'A label' )
32 33 34 35 36 |
# File 'lib/bio/db/nexml/taxa.rb', line 32 def initialize( id, = {}, &block ) @id = id properties( ) unless .empty? block.arity < 1 ? instance_eval( &block ) : block.call( self ) if block_given? end |
Instance Attribute Details
- (Object) id
A file level unique identifier.
16 17 18 |
# File 'lib/bio/db/nexml/taxa.rb', line 16 def id @id end |
- (Object) label
A human readable description.
19 20 21 |
# File 'lib/bio/db/nexml/taxa.rb', line 19 def label @label end |
Instance Method Details
- (Object) to_xml
38 39 40 |
# File 'lib/bio/db/nexml/taxa.rb', line 38 def to_xml @@writer.create_node( "otu", @@writer.attributes( self, :id, :label ) ) end |