Class | Bio::PhyloXML::BinaryCharacters
In: | lib/bio/db/phyloxml/phyloxml_elements.rb
Parent: | Object

## Description

The names and/or counts of binary characters present, gained, and lost at the root of a clade.

### Methods

absent_count= gained_count= lost_count= new present_count= to_xml

### Attributes

absent | [RW] |
absent_count | [R] |
bc_type | [RW] |
gained | [RW] |
gained_count | [R] |
lost | [RW] |
lost_count | [R] |
present | [RW] |
present_count | [R] |

### Public Class methods

new()

[Source]

          # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 1057
    1057:       def initialize
    1058:         @gained = []
    1059:         @lost = []
    1060:         @present = []
    1061:         @absent = []
    1062:       end

### Public Instance methods

absent_count=(str)

[Source]

          # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 1053
    1053:       def absent_count=(str)
    1054:         @absent_count = str.to_i
    1055:       end

gained_count=(str)

[Source]

          # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 1041
    1041:       def gained_count=(str)
    1042:         @gained_count = str.to_i
    1043:       end

lost_count=(str)

[Source]

          # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 1045
    1045:       def lost_count=(str)
    1046:         @lost_count = str.to_i
    1047:       end

present_count=(str)

[Source]

          # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 1049
    1049:       def present_count=(str)
    1050:         @present_count = str.to_i
    1051:       end

to_xml()

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

[Source]

          # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 1065
    1065:       def to_xml
    1066:         bc = LibXML::XML::Node.new('binary_characters')
    1067:         bc['type'] = @bc_type
    1068:         PhyloXML::Writer.generate_xml(bc, self, [
    1069:             [:attr, 'gained_count'],
    1070:             [:attr, 'lost_count'],
    1071:             [:attr, 'present_count'],
    1072:             [:attr, 'absent_count']])
    1073:
    1074:         if not @gained.empty?
    1075:           gained_xml = LibXML::XML::Node.new('gained')
    1076:           PhyloXML::Writer.generate_xml(gained_xml, self, [[:simplearr, 'bc', @gained]])
    1077:           bc << gained_xml
    1078:         end
    1079:
    1080:         if not @lost.empty?
    1081:           lost_xml = LibXML::XML::Node.new('lost')
    1082:           PhyloXML::Writer.generate_xml(lost_xml, self, [[:simplearr, 'bc', @lost]])
    1083:           bc << lost_xml
    1084:         end
    1085:
    1086:         if not @present.empty?
    1087:           present_xml = LibXML::XML::Node.new('present')
    1088:           PhyloXML::Writer.generate_xml(present_xml, self, [[:simplearr, 'bc', @present]])
    1089:           bc << present_xml
    1090:         end
    1091:
    1092:         if not @absent.empty?
    1093:           absent_xml = LibXML::XML::Node.new('absent')
    1094:           PhyloXML::Writer.generate_xml(absent_xml, self, [[:simplearr, 'bc', @absent]])
    1095:           bc << absent_xml
    1096:         end
    1097:
    1098:         return bc
    1099:       end

[Validate]