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[http://nexml.org/nexml/html/doc/schema-1/taxa/taxa/#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 collapse
Instance Attribute Summary collapse
-
#id ⇒ Object
A file level unique identifier.
-
#label ⇒ Object
A human readable description.
Instance Method Summary collapse
-
#initialize(id, options = {}, &block) ⇒ Otu
constructor
Create a new otu.
- #to_xml ⇒ Object
Methods included from Mapper
Constructor Details
#initialize(id, options = {}, &block) ⇒ Otu
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
#id ⇒ Object
A file level unique identifier.
16 17 18 |
# File 'lib/bio/db/nexml/taxa.rb', line 16 def id @id end |
#label ⇒ Object
A human readable description.
19 20 21 |
# File 'lib/bio/db/nexml/taxa.rb', line 19 def label @label end |
Instance Method Details
#to_xml ⇒ Object
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 |