--- pat.h	2010-08-27 13:17:04.000000000 -0400
+++ pat.h.new	2012-01-20 11:23:33.360270710 -0500
@@ -20,6 +20,12 @@
 #include "qual.h"
 #include "hit_set.h"
 #include "search_globals.h"
+#include <errno.h>
+
+static inline const char *ext(const char *s) {
+	const char *x;
+	return (x = strrchr(s, '.')) ? x : "";
+}
 
 /**
  * Classes and routines for reading reads from various input sources.
@@ -1707,6 +1713,18 @@
 			FILE *in;
 			if(infiles_[filecur_] == "-") {
 				in = stdin;
+			} else if(!strcmp(ext(infiles_[filecur_].c_str()),".gz")) {
+				string tmp;
+				tmp = "gunzip -c '";
+				tmp += infiles_[filecur_];
+				tmp += "'";
+				in = popen(tmp.c_str(), "r");
+				if (!in) {
+					cerr << "Warning: Could not popen read file \"" << tmp << "\" for reading (" << strerror(errno) << "); skipping..." << endl;
+					errs_[filecur_] = true;
+					filecur_++;
+					continue;
+				}
 			} else if((in = fopen(infiles_[filecur_].c_str(), "rb")) == NULL) {
 				if(!errs_[filecur_]) {
 					cerr << "Warning: Could not open read file \"" << infiles_[filecur_] << "\" for reading; skipping..." << endl;
