# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
require 'seq'
+require 'zlib'
+require 'pp'
# Error class for all exceptions to do with FASTA.
class FastaError < StandardError; end
class Fasta
include Enumerable
- # Class method allowing open to be used on files.
- # See File.open.
+ # Class method allowing open to be used on (zipped) files.
+ # See File.open and Zlib::GzipReader.
def self.open(*args)
- ios = File.open(*args)
+ ios = File.open(*args)
+
+ begin
+ ios = Zlib::GzipReader.new(ios)
+ rescue
+ ios.rewind
+ end
+
fasta = self.new(ios)
if block_given?