def which_line_reader file_reader
      line_reader = [:each_line]
      # a valid fasta file must have at least two lines, the header
      # and the sequence
      begin
        enum = file_reader.each_line
        # if this was ruby v2.3, then we could just call .size on enum
        2.times do
          enum.next
        end
      rescue StopIteration
        # Zlib::GzipReader can handle \n and \r\n, but not \r, so if
        # we get here, the file has \r only for line endings
        line_reader = [:each, "\r"]
      ensure
        file_reader.rewind
      end

      line_reader
    end
def which_line_reader file_reader
      line_reader = [:each_line]
      # a valid fasta file must have at least two lines, the header
      # and the sequence
      begin
        enum = file_reader.each_line
        # if this was ruby v2.3, then we could just call .size on enum
        2.times do
          enum.next
        end
      rescue StopIteration
        # Zlib::GzipReader can handle \n and \r\n, but not \r, so if
        # we get here, the file has \r only for line endings
        line_reader = [:each, "\r"]
      ensure
        file_reader.rewind
      end

      line_reader
    end
The Zlib::GzipReader can't handle files where the line separator
 is \r. This could all be avoided by using IO.popen("gzip -cd
 #{fname}", "rt"), but will gzip always be available?