williamgilpin / pypdb

A Python API for the RCSB Protein Data Bank (PDB)
MIT License
309 stars 77 forks source link

pypdb is failing in [recent] jupyterlab notebook document #67

Open perllaghu opened 2 months ago

perllaghu commented 2 months ago

I'm getting connection errors - running in a docker image:

Start a docker image:

docker run -it --rm -p 8888:8888 quay.io/jupyter/base-notebook:2024-04-15

Test library

Cell 1:

%mamba install --yes matplotlib pypdb

%matplotlib inline
from IPython.display import HTML

from pypdb import *

%load_ext autoreload
%autoreload 2

found_pdbs = Query("ribosome").search()
print(found_pdbs[:10])

returns

TypeError: 'NoneType' object is not subscriptable

Cell 2 (assumes libraries installed in cell 1):

from pypdb.clients.data.data_types import DataFetcher, DataType
entry = DataFetcher(["4HHB", "12CA", "3PQR"], DataType.ENTRY)
property = {"exptl": ["method", "details"], "cell":["length_a", "length_b", "length_c"]}
entry.add_property(property)
entry.fetch_data()
print(entry.response)

... works:

Cell 3 (also assumes libraries pre-loaded):

from pypdb import *
found_pdbs = Query("ribosome").search()

fails with [/opt/conda/lib/python3.11/site-packages/pypdb/util/http_requests.py:65](http://127.0.0.1:8888/opt/conda/lib/python3.11/site-packages/pypdb/util/http_requests.py#line=64): UserWarning: Too many failures on requests. Exiting... warnings.warn("Too many failures on requests. Exiting...")

.... Can I get confirmation the examples in cells 1 & 3 above are still valid & should work?

williamgilpin commented 2 months ago

I am getting errors as well. The RCSB may have changed their API structure, causing these requests to fail.