Skip to content

Commit

Permalink
Support Path objects for bim and fam arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
horta committed Jun 19, 2024
1 parent 2c9377c commit 61dfd3f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pandas_plink/_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -301,13 +301,17 @@ 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:
raise ValueError("No BIM file has been found.")

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:
Expand Down

0 comments on commit 61dfd3f

Please sign in to comment.