Skip to content

Commit

Permalink
Fix pgen extension bug in PGENWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbonet committed Nov 20, 2024
1 parent 15d5ae8 commit 549b69c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions snputils/snp/io/write/pgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def write(self, vzs: bool = False):
file_extensions = (".pgen", ".psam", ".pvar", ".pvar.zst")
if self.__filename.suffix in file_extensions:
self.__filename = self.__filename.with_suffix('')
self.__file_extension = ".pgen"

self.write_pvar(vzs=vzs)
self.write_psam()
Expand Down Expand Up @@ -113,7 +112,7 @@ def write_pgen(self):
flat_genotypes = self.__snpobj.calldata_gt

with pg.PgenWriter(
filename=str(self.__filename).encode('utf-8'),
filename=f"{self.__filename}.pgen".encode('utf-8'),
sample_ct=num_samples,
variant_ct=num_variants,
hardcall_phase_present=phased,
Expand Down

0 comments on commit 549b69c

Please sign in to comment.