From 61dfd3f7965255b6177602c4210a0977f7003c5c Mon Sep 17 00:00:00 2001 From: Danilo Horta Date: Wed, 19 Jun 2024 21:41:09 +0100 Subject: [PATCH] Support Path objects for bim and fam arguments --- pandas_plink/_read.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandas_plink/_read.py b/pandas_plink/_read.py index ef0fe9d..92ae8f7 100755 --- a/pandas_plink/_read.py +++ b/pandas_plink/_read.py @@ -166,8 +166,8 @@ def read_plink(file_prefix: Union[str, Path], verbose=True): def read_plink1_bin( bed: Union[str, Path], - bim: Optional[str] = None, - fam: Optional[str] = None, + bim: Optional[Union[str, Path]] = None, + fam: Optional[Union[str, Path]] = None, verbose: bool = True, ref: str = "a1", chunk: Chunk = Chunk(), @@ -301,6 +301,8 @@ def read_plink1_bin( if bim is None: bim_files = [last_replace(f, ".bed", ".bim") for f in bed_files] + elif isinstance(bim, Path): + bim_files = [str(bim.resolve())] else: bim_files = sorted(glob(bim)) if len(bim_files) == 0: @@ -308,6 +310,8 @@ def read_plink1_bin( if fam is None: fam_files = [last_replace(f, ".bed", ".fam") for f in bed_files] + elif isinstance(fam, Path): + fam_files = [str(fam.resolve())] else: fam_files = sorted(glob(fam)) if len(fam_files) == 0: