Open aaronfinke opened 1 year ago
data = fetch(id="7QRZ",log=null_out(),format="pdb", local_cache=None)
returns a byte string, and iotbx.pdb.hierarchy.input
expects a standard Python string, so you simply need to change the following line to:
pdb_in = iotbx.pdb.hierarchy.input(pdb_string=data.read().decode())
.
In addition to Richard's suggestion, you should use iotbx.pdb.input directly, since I'm going to remove iotbx.pdb.hierarchy.input some time soon.
Now I am getting the following error:
ModuleNotFoundError Traceback (most recent call last) Cell In[14], line 1 ----> 1 pdbStructure = iotbx.pdb.fetch.load_pdb_structure('1rqw', format="pdb")
File /gpfs/offline1/staff/biomax/aarfin/mambaforge/envs/edna2/lib/python3.10/site-packages/iotbx/pdb/fetch.py:217, in load_pdb_structure(id, format, allow_unknowns, local_cache) 212 """ 213 Simple utility method to load the PDB hierarchy and xray structure objects 214 directly (without intermediate files). 215 """ 216 data = fetch(id=id, format=format, log=null_out(), local_cache=local_cache) --> 217 import iotbx.pdb.input 218 pdb_in = iotbx.pdb.input(pdb_string=data.read()) 219 hierarchy = pdb_in.construct_hierarchy()
ModuleNotFoundError: No module named 'iotbx.pdb.input'`
@olegsobolev Should that import be just import iotbx.pdb
? I also get the import error when I try import iotbx.pdb.input
. But this works
import iotbx.pdb
iotbx.pdb.input
<function input at 0x12652a430>
Fixed: https://github.com/cctbx/cctbx_project/commit/44a6dc3d94fb967dabef1d28c2957e823c136994 Note, that this function returns both hierarchy and xray_structure objects, so I would recommend to use it like I did in the test. If you need pdb_input, refer to the implementation.
When I try the following (version 2023.05):
I get the following error: