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
62 def initialize(x)
63   if x.is_a?(REXML::Element) then
64     @elem = x
65   else
66     if x.is_a?(String) then
67       x = x.sub(/#{Regexp.escape(DELIMITER)}\z/om, "\n")
68     end
69     doc = REXML::Document.new(x)
70     @elem = doc.elements[self.class::Data_XPath]
71     #raise 'element is null' unless @elem
72     @elem = REXML::Document.new('') unless @elem
73   end
74 end

Public Instance Methods

entry_id() click to toggle source
   # File lib/bio/db/fantom.rb
90 def entry_id
91   unless defined?(@entry_id)
92     @entry_id = @elem.attributes['id']
93   end
94   @entry_id
95 end
gsub_entities(str) click to toggle source
   # File lib/bio/db/fantom.rb
81 def gsub_entities(str)
82   # workaround for bug?
83   if str then
84     str.gsub(/\&\#(\d{1,3})\;/) { sprintf("%c", $1.to_i) }
85   else
86     str
87   end
88 end
to_s() click to toggle source
   # File lib/bio/db/fantom.rb
77 def to_s
78   @elem.to_s
79 end