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]
id_ref_1[RW]
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/db/phyloxml/phyloxml_elements.rb, line 1136
def distance=(str)
  @distance = str.to_f if str != nil
end
to_xml() click to toggle source

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

# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 1156
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
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/db/phyloxml/phyloxml_elements.rb, line 1143
def type=(str)
  #@todo do warning instead?
  #@todo do validation at actually writing xml
  allowed_values = ["orthology", "one_to_one_orthology", "super_orthology", "paralogy",
      "ultra_paralogy", "xenology", "unknown", "other"]
  if not allowed_values.include? str
    raise "SequenceRelation#type has to be one one of #{allowed_values.join("; ")}"
  else
    @type = str
  end
end