Class: Bio::PhyloXML::Accession

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/db/phyloxml/phyloxml_elements.rb

Overview

Description

Element Accession is used to capture the local part in a sequence identifier.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) source

String. Source of the accession id. Example: “UniProtKB”



650
651
652
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 650

def source
  @source
end

- (Object) value

String. Value of the accession id. Example: “P17304”



653
654
655
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 653

def value
  @value
end

Instance Method Details

- (Object) to_xml

Converts elements to xml representation. Called by PhyloXML::Writer class.



656
657
658
659
660
661
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 656

def to_xml
  raise "Source attribute is required for Accession object." if @source == nil
  accession = LibXML::XML::Node.new('accession', @value)
  accession['source'] = @source
  return accession
end