Class: Bio::PhyloXML::SequenceRelation
- Inherits:
-
Object
- Object
- Bio::PhyloXML::SequenceRelation
- Defined in:
- lib/bio/db/phyloxml/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)
-
- (Object) distance
Float.
-
- (Object) id_ref_0
String.
-
- (Object) id_ref_1
String.
-
- (Object) type
String.
Instance Method Summary (collapse)
-
- (Object) to_xml
Converts elements to xml representation.
Instance Attribute Details
- (Object) distance
Float
1112 1113 1114 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 1112 def distance @distance end |
- (Object) id_ref_0
String
1110 1111 1112 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 1110 def id_ref_0 @id_ref_0 end |
- (Object) id_ref_1
String
1110 1111 1112 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 1110 def id_ref_1 @id_ref_1 end |
- (Object) type
String
1110 1111 1112 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 1110 def type @type end |
Instance Method Details
- (Object) to_xml
Converts elements to xml representation. Called by PhyloXML::Writer class.
1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 1133 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 |