Class: Bio::PhyloXML::ProteinDomain

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

Overview

Description

To represent an individual domain in a domain architecture. The name/unique identifier is described via the ‘id’ attribute.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#confidenceObject

Float, for example to store E-values 4.7E-14



881
882
883
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 881

def confidence
  @confidence
end

#fromObject

Integer. Beginning of the domain.



887
888
889
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 887

def from
  @from
end

#idObject

String



884
885
886
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 884

def id
  @id
end

#toObject

Integer. End of the domain.



890
891
892
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 890

def to
  @to
end

#valueObject

String



884
885
886
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 884

def value
  @value
end

Instance Method Details

#to_xmlObject

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



908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 908

def to_xml
  if @from == nil
    raise "from attribute of ProteinDomain class is required."
  elsif @to == nil
    raise "to attribute of ProteinDomain class is required."
  else
    xml_node = LibXML::XML::Node.new('domain', @value)
    xml_node["from"] = @from.to_s
    xml_node["to"] = @to.to_s
    xml_node["id"] = @id if (defined? @id) && @id
    xml_node["confidence"] = @confidence.to_s

    return xml_node
  end

end