a-r-j / graphein

Protein Graph Library
https://graphein.ai/
MIT License
1.01k stars 126 forks source link

`construct_graph` in `protein.graphs` should accept a `Path` object or `str` #269

Closed kamurani closed 1 year ago

kamurani commented 1 year ago

When passing specific filenames to the construct_graph function (as opposed to including a pdb_dir in the ProteinGraphConfig(), for instance), only strings can be passed or an error results.

This, and similar functions, should be able to receive any Path-like object.

e.g.

pdb_path = Path("../data") / "6hd4.pdb" 
g = construct_graph(pdb_path=pdb_path)
--> 305 if path.endswith((".pdb", ".ent")):
    306     openf = open
    307 elif path.endswith(("pdb.gz", ".ent.gz")):

AttributeError: 'PosixPath' object has no attribute 'endswith'
a-r-j commented 1 year ago

Now resolved in 1.6.0

pip install graphein=1.6.0