class Bio::FANTOM::MaXML
Constants
- DELIMITER
DTD of MaXML(Mouse annotation XML) fantom.gsc.riken.go.jp/maxml/maxml.dtd
- Data_XPath
This class is for {allseq|repseq|allclust}.sep.xml, not for {allseq|repseq|allclust}.xml.
Attributes
elem[R]
Public Class Methods
new(x)
click to toggle source
# File lib/bio/db/fantom.rb, line 62 def initialize(x) if x.is_a?(REXML::Element) then @elem = x else if x.is_a?(String) then x = x.sub(/#{Regexp.escape(DELIMITER)}\z/om, "\n") end doc = REXML::Document.new(x) @elem = doc.elements[self.class::Data_XPath] #raise 'element is null' unless @elem @elem = REXML::Document.new('') unless @elem end end
Private Class Methods
define_element_text_method(array)
click to toggle source
# File lib/bio/db/fantom.rb, line 96 def self.define_element_text_method(array) array.each do |tagstr| module_eval(" def #{tagstr} unless defined?(@#{tagstr}) @#{tagstr} = gsub_entities(@elem.text('#{tagstr}')) end @#{tagstr} end ") end end
Public Instance Methods
entry_id()
click to toggle source
# File lib/bio/db/fantom.rb, line 90 def entry_id unless defined?(@entry_id) @entry_id = @elem.attributes['id'] end @entry_id end
gsub_entities(str)
click to toggle source
# File lib/bio/db/fantom.rb, line 81 def gsub_entities(str) # workaround for bug? if str then str.gsub(/\&\#(\d{1,3})\;/) { sprintf("%c", $1.to_i) } else str end end
to_s()
click to toggle source
# File lib/bio/db/fantom.rb, line 77 def to_s @elem.to_s end