Class: Bio::PhyloXML::BinaryCharacters
- Inherits:
-
Object
- Object
- Bio::PhyloXML::BinaryCharacters
- Defined in:
- lib/bio-phyloxml/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.
1060 1061 1062 1063 1064 1065 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1060 def initialize @gained = [] @lost = [] @present = [] @absent = [] end |
Instance Attribute Details
#absent ⇒ Object
Returns the value of attribute absent.
1041 1042 1043 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1041 def absent @absent end |
#absent_count ⇒ Object
Returns the value of attribute absent_count.
1042 1043 1044 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1042 def absent_count @absent_count end |
#bc_type ⇒ Object
Returns the value of attribute bc_type.
1041 1042 1043 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1041 def bc_type @bc_type end |
#gained ⇒ Object
Returns the value of attribute gained.
1041 1042 1043 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1041 def gained @gained end |
#gained_count ⇒ Object
Returns the value of attribute gained_count.
1042 1043 1044 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1042 def gained_count @gained_count end |
#lost ⇒ Object
Returns the value of attribute lost.
1041 1042 1043 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1041 def lost @lost end |
#lost_count ⇒ Object
Returns the value of attribute lost_count.
1042 1043 1044 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1042 def lost_count @lost_count end |
#present ⇒ Object
Returns the value of attribute present.
1041 1042 1043 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1041 def present @present end |
#present_count ⇒ Object
Returns the value of attribute present_count.
1042 1043 1044 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1042 def present_count @present_count end |
Instance Method Details
#to_xml ⇒ Object
Converts elements to xml representation. Called by PhyloXML::Writer class.
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 |
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1068 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 |