Class: Bio::PhyloXML::SequenceRelation
- Inherits:
-
Object
- Object
- Bio::PhyloXML::SequenceRelation
- Defined in:
- lib/bio/phyloxml/elements.rb
Overview
Description
This is used to express a typed relationship between two sequences. For example it could be used to describe an orthology (in which case attribute ‘type’ is ‘orthology’).
Instance Attribute Summary collapse
-
#distance ⇒ Object
Float.
-
#id_ref_0 ⇒ Object
String.
-
#id_ref_1 ⇒ Object
String.
-
#type ⇒ Object
String.
Instance Method Summary collapse
-
#to_xml ⇒ Object
Converts elements to xml representation.
Instance Attribute Details
#distance ⇒ Object
Float
1104 1105 1106 |
# File 'lib/bio/phyloxml/elements.rb', line 1104 def distance @distance end |
#id_ref_0 ⇒ Object
String
1102 1103 1104 |
# File 'lib/bio/phyloxml/elements.rb', line 1102 def id_ref_0 @id_ref_0 end |
#id_ref_1 ⇒ Object
String
1102 1103 1104 |
# File 'lib/bio/phyloxml/elements.rb', line 1102 def id_ref_1 @id_ref_1 end |
#type ⇒ Object
String
1102 1103 1104 |
# File 'lib/bio/phyloxml/elements.rb', line 1102 def type @type end |
Instance Method Details
#to_xml ⇒ Object
Converts elements to xml representation. Called by PhyloXML::Writer class.
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 |
# File 'lib/bio/phyloxml/elements.rb', line 1125 def to_xml if @id_ref_0 == nil or @id_ref_1 == nil or @type == nil raise "Attributes id_ref_0, id_ref_1, type are required elements by SequenceRelation element." else sr = LibXML::XML::Node.new('sequence_relation') sr['id_ref_0'] = @id_ref_0 sr['id_ref_1'] = @id_ref_1 sr['distance'] = @distance.to_s if @distance != nil sr['type'] = @type return sr end end |