Set Vcf metadata also for VcfGz files

This commit is contained in:
Nicola Soranzo
2021-02-19 11:50:57 +00:00
parent 26f731f060
commit ebf996f8bc
+6 -7
View File
@@ -743,13 +743,12 @@ class BaseVcf(Tabular):
def set_meta(self, dataset, **kwd):
super().set_meta(dataset, **kwd)
source = open(dataset.file_name)
# Skip comments.
line = None
for line in source:
if not line.startswith('##'):
break
with compression_utils.get_fileobj(dataset.file_name) as fh:
# Skip comments.
for line in fh:
if not line.startswith('##'):
break
if line and line.startswith('#'):
# Found header line, get sample names.
@@ -815,7 +814,7 @@ class VcfGz(BaseVcf, binary.Binary):
return binascii.hexlify(last28) == b'1f8b08040000000000ff0600424302001b0003000000000000000000'
def set_meta(self, dataset, **kwd):
super(BaseVcf, self).set_meta(dataset, **kwd)
super().set_meta(dataset, **kwd)
""" Creates the index for the VCF file. """
# These metadata values are not accessible by users, always overwrite
index_file = dataset.metadata.tabix_index