Class: Bio::PhyloXML::SequenceRelation

Inherits:
Object
  • Object
show all
Defined in:
lib/bio-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

Instance Method Summary collapse

Instance Attribute Details

#distanceObject

Float



1121
1122
1123
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1121

def distance
  @distance
end

#id_ref_0Object

String



1113
1114
1115
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1113

def id_ref_0
  @id_ref_0
end

#id_ref_1Object

String



1113
1114
1115
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1113

def id_ref_1
  @id_ref_1
end

#typeObject

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



1118
1119
1120
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1118

def type
  @type
end

Instance Method Details

#to_xmlObject

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



1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 1145

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 (defined? @distance) && @distance
    sr['type'] = @type
    return sr
  end
end