Class: Bio::PhyloXML::CladeRelation

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/phyloxml/elements.rb

Overview

Description

This is used to express a typed relationship between two clades. For example it could be used to describe multiple parents of a clade.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#confidenceObject

Confidence object



1000
1001
1002
# File 'lib/bio/phyloxml/elements.rb', line 1000

def confidence
  @confidence
end

#distanceObject

Float



994
995
996
# File 'lib/bio/phyloxml/elements.rb', line 994

def distance
  @distance
end

#id_ref_0Object

String. Id of the referenced parents of a clade.



996
997
998
# File 'lib/bio/phyloxml/elements.rb', line 996

def id_ref_0
  @id_ref_0
end

#id_ref_1Object

String. Id of the referenced parents of a clade.



996
997
998
# File 'lib/bio/phyloxml/elements.rb', line 996

def id_ref_1
  @id_ref_1
end

#typeObject

String



998
999
1000
# File 'lib/bio/phyloxml/elements.rb', line 998

def type
  @type
end

Instance Method Details

#to_xmlObject

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



1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
# File 'lib/bio/phyloxml/elements.rb', line 1007

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
    cr = LibXML::XML::Node.new('clade_relation')
    Writer.generate_xml(cr, self, [
        [:attr, 'id_ref_0'],
        [:attr, 'id_ref_1'],
        [:attr, 'distance'],
        [:attr, 'type'],
        [:complex, 'confidence', @confidnece]])         

    return cr
  end
end