class Bio::EMBLDB
Public Class Methods
new(entry, tagsize)
click to toggle source
The entire entry is passed as a String. The length of the tag field is passed as an Integer. Parses the entry roughly by the entry2hash method and returns a database object.
# File lib/bio/db.rb 306 def initialize(entry, tagsize) 307 @tagsize = tagsize 308 @orig = entry2hash(entry.strip) # Hash of the original entry 309 @data = {} # Hash of the parsed entry 310 end
Private Instance Methods
entry2hash(entry)
click to toggle source
Returns the contents of the entry as a Hash.
# File lib/bio/db.rb 315 def entry2hash(entry) 316 hash = Hash.new { |h,k| h[k] = '' } 317 entry.each_line do |line| 318 tag = tag_get(line) 319 next if tag == 'XX' 320 tag = 'R' if tag =~ /^R./ # Reference lines 321 hash[tag].concat line 322 end 323 return hash 324 end