lib/bio/db/gff/gffnocache.rb in bio-gff3-0.8.0 vs lib/bio/db/gff/gffnocache.rb in bio-gff3-0.8.2
- old
+ new
@@ -13,20 +13,23 @@
module Digest
module NoCacheHelpers
+ # Module to fetch a line from GFF3 file and returns a parsed
+ # record
module SeekRec
# Fetch a record using fh and file seek position
def SeekRec::fetch(fh,fpos)
return nil if fh==nil or fpos==nil
fh.seek(fpos)
GFF::GFF3::FileRecord.new(fpos, fh.gets)
end
end
- # The hardwired to file RecList
+ # Helper class which gives Hash-like access to the
+ # no-cache GFF3 file
class SeekRecList
def initialize fh
@fh = fh
@h = {}
end
@@ -47,9 +50,10 @@
yield id, self[id]
end
end
end
+ # List of ids
class SeekLinkedRecs < Hash
include Helpers::Error
def add id, rec
info "Adding #{rec.feature_type} <#{id}>"
self[id] = [] if self[id] == nil