Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Enable compression to be disabled for .gz filenames

  • Loading branch information...
commit ec193b12b9443dc40b0ea49cde134fe60915b60f 1 parent 9345ca9
@cariaso cariaso authored martijnvermaat committed
Showing with 5 additions and 3 deletions.
  1. +5 −3 vcf/parser.py
View
8 vcf/parser.py
@@ -233,7 +233,7 @@ def read_meta(self, meta_string):
class Reader(object):
""" Reader for a VCF v 4.0 file, an iterator returning ``_Record objects`` """
- def __init__(self, fsock=None, filename=None, compressed=False, prepend_chr=False,
+ def __init__(self, fsock=None, filename=None, compressed=None, prepend_chr=False,
strict_whitespace=False):
""" Create a new Reader for a VCF file.
@@ -256,9 +256,11 @@ def __init__(self, fsock=None, filename=None, compressed=False, prepend_chr=Fals
self._reader = fsock
if filename is None and hasattr(fsock, 'name'):
filename = fsock.name
- compressed = compressed or filename.endswith('.gz')
+ if compressed is None:
+ compressed = filename.endswith('.gz')
elif filename:
- compressed = compressed or filename.endswith('.gz')
+ if compressed is None:
+ compressed = filename.endswith('.gz')
self._reader = open(filename, 'rb' if compressed else 'rt')
self.filename = filename
if compressed:
Please sign in to comment.
Something went wrong with that request. Please try again.