Class: Bio::PhyloXML::Annotation

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/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.



707
708
709
710
# File 'lib/bio/phyloxml/elements.rb', line 707

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.



700
701
702
# File 'lib/bio/phyloxml/elements.rb', line 700

def confidence
  @confidence
end

#descObject

String. Free text description.



698
699
700
# File 'lib/bio/phyloxml/elements.rb', line 698

def desc
  @desc
end

#evidenceObject

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



694
695
696
# File 'lib/bio/phyloxml/elements.rb', line 694

def evidence
  @evidence
end

#propertiesObject

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



703
704
705
# File 'lib/bio/phyloxml/elements.rb', line 703

def properties
  @properties
end

#refObject

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



690
691
692
# File 'lib/bio/phyloxml/elements.rb', line 690

def ref
  @ref
end

#sourceObject

String



692
693
694
# File 'lib/bio/phyloxml/elements.rb', line 692

def source
  @source
end

#typeObject

String. Type of the annotation.



696
697
698
# File 'lib/bio/phyloxml/elements.rb', line 696

def type
  @type
end

#uriObject

Uri object.



705
706
707
# File 'lib/bio/phyloxml/elements.rb', line 705

def uri
  @uri
end

Instance Method Details

#to_xmlObject

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



713
714
715
716
717
718
719
720
721
# File 'lib/bio/phyloxml/elements.rb', line 713

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