class Bio::PhyloXML::SequenceRelation

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’).

Attributes

distance[R]

Float

id_ref_0[RW]

String

id_ref_1[RW]

String

type[R]

String. Allowed values: “orthology”, “one_to_one_orthology”, “super_orthology”, “paralogy”, “ultra_paralogy”, “xenology”, “unknown”, “other”

Public Instance Methods

distance=(str) click to toggle source

@todo it has Confidences objects.

     # File lib/bio-phyloxml/phyloxml_elements.rb
1125 def distance=(str)
1126   @distance = str.to_f if str != nil
1127 end
to_xml() click to toggle source

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

     # File lib/bio-phyloxml/phyloxml_elements.rb
1145 def to_xml
1146   if @id_ref_0 == nil or @id_ref_1 == nil or @type == nil
1147     raise "Attributes id_ref_0, id_ref_1, type are required elements by SequenceRelation element."
1148   else
1149     sr = LibXML::XML::Node.new('sequence_relation')
1150     sr['id_ref_0'] = @id_ref_0
1151     sr['id_ref_1'] = @id_ref_1
1152     sr['distance'] = @distance.to_s if (defined? @distance) && @distance
1153     sr['type'] = @type
1154     return sr
1155   end
1156 end
type=(str) click to toggle source

String. Allowed values: “orthology”, “one_to_one_orthology”, “super_orthology”, “paralogy”, “ultra_paralogy”, “xenology”, “unknown”, “other”

     # File lib/bio-phyloxml/phyloxml_elements.rb
1132 def type=(str)
1133   #@todo do warning instead?
1134   #@todo do validation at actually writing xml
1135   allowed_values = ["orthology", "one_to_one_orthology", "super_orthology", "paralogy",
1136       "ultra_paralogy", "xenology", "unknown", "other"]
1137   if not allowed_values.include? str
1138     raise "SequenceRelation#type has to be one one of #{allowed_values.join("; ")}"
1139   else
1140     @type = str
1141   end
1142 end