Class: Bio::PhyloXML::BinaryCharacters
- Inherits:
-
Object
- Object
- Bio::PhyloXML::BinaryCharacters
- Defined in:
- lib/bio/phyloxml/elements.rb
Overview
Description
The names and/or counts of binary characters present, gained, and lost at the root of a clade.
Instance Attribute Summary collapse
-
#absent ⇒ Object
Returns the value of attribute absent.
-
#absent_count ⇒ Object
Returns the value of attribute absent_count.
-
#bc_type ⇒ Object
Returns the value of attribute bc_type.
-
#gained ⇒ Object
Returns the value of attribute gained.
-
#gained_count ⇒ Object
Returns the value of attribute gained_count.
-
#lost ⇒ Object
Returns the value of attribute lost.
-
#lost_count ⇒ Object
Returns the value of attribute lost_count.
-
#present ⇒ Object
Returns the value of attribute present.
-
#present_count ⇒ Object
Returns the value of attribute present_count.
Instance Method Summary collapse
-
#initialize ⇒ BinaryCharacters
constructor
A new instance of BinaryCharacters.
-
#to_xml ⇒ Object
Converts elements to xml representation.
Constructor Details
#initialize ⇒ BinaryCharacters
Returns a new instance of BinaryCharacters.
1049 1050 1051 1052 1053 1054 |
# File 'lib/bio/phyloxml/elements.rb', line 1049 def initialize @gained = [] @lost = [] @present = [] @absent = [] end |
Instance Attribute Details
#absent ⇒ Object
Returns the value of attribute absent.
1030 1031 1032 |
# File 'lib/bio/phyloxml/elements.rb', line 1030 def absent @absent end |
#absent_count ⇒ Object
Returns the value of attribute absent_count.
1031 1032 1033 |
# File 'lib/bio/phyloxml/elements.rb', line 1031 def absent_count @absent_count end |
#bc_type ⇒ Object
Returns the value of attribute bc_type.
1030 1031 1032 |
# File 'lib/bio/phyloxml/elements.rb', line 1030 def bc_type @bc_type end |
#gained ⇒ Object
Returns the value of attribute gained.
1030 1031 1032 |
# File 'lib/bio/phyloxml/elements.rb', line 1030 def gained @gained end |
#gained_count ⇒ Object
Returns the value of attribute gained_count.
1031 1032 1033 |
# File 'lib/bio/phyloxml/elements.rb', line 1031 def gained_count @gained_count end |
#lost ⇒ Object
Returns the value of attribute lost.
1030 1031 1032 |
# File 'lib/bio/phyloxml/elements.rb', line 1030 def lost @lost end |
#lost_count ⇒ Object
Returns the value of attribute lost_count.
1031 1032 1033 |
# File 'lib/bio/phyloxml/elements.rb', line 1031 def lost_count @lost_count end |
#present ⇒ Object
Returns the value of attribute present.
1030 1031 1032 |
# File 'lib/bio/phyloxml/elements.rb', line 1030 def present @present end |
#present_count ⇒ Object
Returns the value of attribute present_count.
1031 1032 1033 |
# File 'lib/bio/phyloxml/elements.rb', line 1031 def present_count @present_count end |
Instance Method Details
#to_xml ⇒ Object
Converts elements to xml representation. Called by PhyloXML::Writer class.
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 |
# File 'lib/bio/phyloxml/elements.rb', line 1057 def to_xml bc = LibXML::XML::Node.new('binary_characters') bc['type'] = @bc_type PhyloXML::Writer.generate_xml(bc, self, [ [:attr, 'gained_count'], [:attr, 'lost_count'], [:attr, 'present_count'], [:attr, 'absent_count']]) if not @gained.empty? gained_xml = LibXML::XML::Node.new('gained') PhyloXML::Writer.generate_xml(gained_xml, self, [[:simplearr, 'bc', @gained]]) bc << gained_xml end if not @lost.empty? lost_xml = LibXML::XML::Node.new('lost') PhyloXML::Writer.generate_xml(lost_xml, self, [[:simplearr, 'bc', @lost]]) bc << lost_xml end if not @present.empty? present_xml = LibXML::XML::Node.new('present') PhyloXML::Writer.generate_xml(present_xml, self, [[:simplearr, 'bc', @present]]) bc << present_xml end if not @absent.empty? absent_xml = LibXML::XML::Node.new('absent') PhyloXML::Writer.generate_xml(absent_xml, self, [[:simplearr, 'bc', @absent]]) bc << absent_xml end return bc end |