class Bio::NeXML::Otu

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

Attributes

id[RW]

A file level unique identifier.

label[RW]

A human readable description.

Public Class Methods

new( id, options = {}, &block ) click to toggle source

Create a new otu.

otu = Bio::NeXML::Otu.id( 'o1' )
otu = Bio::NeXML::Otu.id( 'o1', :label => 'A label' )
# File lib/bio/db/nexml/taxa.rb, line 32
def initialize( id, options = {}, &block )
  @id = id
  properties( options ) unless options.empty?
  block.arity < 1 ? instance_eval( &block ) : block.call( self ) if block_given?
end

Public Instance Methods

to_xml() click to toggle source
# File lib/bio/db/nexml/taxa.rb, line 38
def to_xml
  @@writer.create_node( "otu", @@writer.attributes( self, :id, :label ) )
end