Class: Bio::FANTOM::MaXML
Direct Known Subclasses
Defined Under Namespace
Classes: Annotation, Annotations, Cluster, Sequence, Sequences
Constant Summary collapse
- DELIMITER =
DTD of MaXML(Mouse annotation XML) fantom.gsc.riken.go.jp/maxml/maxml.dtd
RS = "\n--EOF--\n"
- Data_XPath =
This class is for allseq|repseq|allclust.sep.xml, not for allseq|repseq|allclust.xml.
''
Instance Attribute Summary collapse
-
#elem ⇒ Object
readonly
Returns the value of attribute elem.
Instance Method Summary collapse
- #entry_id ⇒ Object
- #gsub_entities(str) ⇒ Object
-
#initialize(x) ⇒ MaXML
constructor
A new instance of MaXML.
- #to_s ⇒ Object
Methods inherited from DB
#exists?, #fetch, #get, open, #tags
Constructor Details
#initialize(x) ⇒ MaXML
Returns a new instance of MaXML.
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# 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 |
Instance Attribute Details
#elem ⇒ Object (readonly)
Returns the value of attribute elem.
75 76 77 |
# File 'lib/bio/db/fantom.rb', line 75 def elem @elem end |
Instance Method Details
#entry_id ⇒ Object
90 91 92 93 94 95 |
# 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) ⇒ Object
81 82 83 84 85 86 87 88 |
# 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 ⇒ Object
77 78 79 |
# File 'lib/bio/db/fantom.rb', line 77 def to_s @elem.to_s end |