]> git.donarmstrong.com Git - biopieces.git/blobdiff - code_ruby/lib/maasha/fastq.rb
finished refactoring s/has_key?/[]/
[biopieces.git] / code_ruby / lib / maasha / fastq.rb
index 77a4706efa01a9a03ce7181ae6a7d0d4e738ead9..4ac44aa70cb84045158fc775f782be7719fdbbbd 100644 (file)
@@ -36,7 +36,7 @@ class Fastq < Filesys
     begin
       seq_name       = @io.gets.chomp!
       seq            = @io.gets.chomp!
-      qual_name      = @io.gets.chomp!
+      @io.gets
       qual           = @io.gets.chomp!
 
       entry          = Seq.new
@@ -64,7 +64,7 @@ class FastqIndex
 
   # Method to initialize a FastqIndex object. For reading
   # entries from file an _ios_ object must be supplied.
-  def initialize(ios)
+  def initialize(ios = nil)
     @ios    = ios
     @index  = {}
     @offset = 0
@@ -83,7 +83,7 @@ class FastqIndex
   # Method to read from file a Fastq entry from an indexed position,
   # and return the entry as a Seq object.
   def get(seq_name)
-    raise FastqError, "Sequence name: #{seq_name} not found in index." unless @index.has_key? seq_name
+    raise FastqError, "Sequence name: #{seq_name} not found in index." unless @index[seq_name]
 
     elem = @index[seq_name]
     @ios.sysseek(elem.offset_seq)