Skip to content
Snippets Groups Projects
Commit 10c6f0d7 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add ws function to check if a PDB entry exists

Former-commit-id: 6d985f2167bda81cb08bad3b9cc5e4738a96e5a1
parent 7cd0b6ab
No related branches found
No related tags found
No related merge requests found
......@@ -83,3 +83,12 @@ def get_pdb_uniprot_mapping(pdb_id):
resp = requests.get('https://www.ebi.ac.uk/pdbe/api/mappings/uniprot/{}'.format(pdb_id.lower()))
uniprot_ids = list(resp.json()[pdb_id]['UniProt'].keys())
return uniprot_ids
def pdb_entry_exists(pdb_id):
""" test if a PDB entry exists using EBI web services """
resp = requests.get('https://www.ebi.ac.uk/pdbe/api/pdb/entry/summary/{}'.format(pdb_id.lower()))
# EBI sends back either a 404 or an empty json if the PDB does not exist
if not(resp.ok):
return False
else:
return True
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment