Class: Bio::PhyloXML::Annotation

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

Overview

Description

The annotation of a molecular sequence. It is recommended to annotate by using the optional ‘ref’ attribute (some examples of acceptable values for the ref attribute: ‘GO:0008270’, ‘KEGG:Tetrachloroethene degradation’,

'EC:1.1.1.1').

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAnnotation

Returns a new instance of Annotation.



724
725
726
727
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 724

def initialize
  #@todo add unit test for this, since didn't break anything when changed from property to properties
  @properties = []
end

Instance Attribute Details

#confidenceObject

Confidence object. Type and value of support for a annotation.



717
718
719
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 717

def confidence
  @confidence
end

#descObject

String. Free text description.



715
716
717
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 715

def desc
  @desc
end

#evidenceObject

String. evidence for a annotation as free text (e.g. ‘experimental’)



711
712
713
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 711

def evidence
  @evidence
end

#propertiesObject

Array of Property objects. Allows for further, typed and referenced annotations from external resources



720
721
722
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 720

def properties
  @properties
end

#refObject

String. For example, ‘GO:0008270’, ‘KEGG:Tetrachloroethene degradation’, ‘EC:1.1.1.1’



707
708
709
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 707

def ref
  @ref
end

#sourceObject

String



709
710
711
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 709

def source
  @source
end

#typeObject

String. Type of the annotation.



713
714
715
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 713

def type
  @type
end

#uriObject

Uri object.



722
723
724
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 722

def uri
  @uri
end

Instance Method Details

#to_xmlObject

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



730
731
732
733
734
735
736
737
738
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 730

def to_xml
  annot = LibXML::XML::Node.new('annotation')
  annot["ref"] = @ref if (defined? @ref) && @ref
  PhyloXML::Writer.generate_xml(annot, self, [[:simple, 'desc', (defined? @desc) ? @desc : nil],
    [:complex, 'confidence', (defined? @confidence) ? @confidence : nil],
    [:objarr, 'property', 'properties'],
    [:complex, 'uri', (defined? @uri) ? @uri : nil]])
  return annot
end