Skip to content

Commit 61dfd3f

Browse files
committed
Support Path objects for bim and fam arguments
1 parent 2c9377c commit 61dfd3f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pandas_plink/_read.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ def read_plink(file_prefix: Union[str, Path], verbose=True):
166166

167167
def read_plink1_bin(
168168
bed: Union[str, Path],
169-
bim: Optional[str] = None,
170-
fam: Optional[str] = None,
169+
bim: Optional[Union[str, Path]] = None,
170+
fam: Optional[Union[str, Path]] = None,
171171
verbose: bool = True,
172172
ref: str = "a1",
173173
chunk: Chunk = Chunk(),
@@ -301,13 +301,17 @@ def read_plink1_bin(
301301

302302
if bim is None:
303303
bim_files = [last_replace(f, ".bed", ".bim") for f in bed_files]
304+
elif isinstance(bim, Path):
305+
bim_files = [str(bim.resolve())]
304306
else:
305307
bim_files = sorted(glob(bim))
306308
if len(bim_files) == 0:
307309
raise ValueError("No BIM file has been found.")
308310

309311
if fam is None:
310312
fam_files = [last_replace(f, ".bed", ".fam") for f in bed_files]
313+
elif isinstance(fam, Path):
314+
fam_files = [str(fam.resolve())]
311315
else:
312316
fam_files = sorted(glob(fam))
313317
if len(fam_files) == 0:

0 commit comments

Comments
 (0)