Datasets:
| # Some PDB entries referenced in the dataset were missing structure files. | |
| # This might happened becuase the up-to-date SAAINT-DB dataset was generated in February 2026, while the PDB files were uploaded in January 2026. | |
| # We identified the missing entries and downloaded 111 mmCIF files from the RCSB Protein Data Bank (PDB), | |
| # updating the dataset to reflect the available structures as of February 2026. | |
| import os | |
| import requests | |
| import time | |
| from pathlib import Path | |
| missing = {'10gh', '12e8', '21du', '22ps', '9d72', '9d73', '9d74', '9dz4', '9gei', '9gjg', '9i3w', '9i3x', '9i3z', '9i40', '9i41', '9i42', '9i43', '9i45', '9i4b', '9i4c', '9i4d', '9i4e', '9i5n', '9i6q', '9i9h', '9j5l', '9j87', '9jno', '9l1l', '9l8z', '9l9o', '9lqu', '9lqw', '9lqx', '9lr1', '9lr2', '9lr3', '9lrs', '9lsy', '9lsz', '9lw5', '9lwc', '9n2v', '9n38', '9n7m', '9n7o', '9n7q', '9n7s', '9n7t', '9n7v', '9n8f', '9n8i', '9n8j', '9n8n', '9ncd', '9nln', '9nnz', '9noz', '9nvg', '9nyx', '9o8m', '9o8q', '9o8r', '9o8s', '9o8t', '9oed', '9oi2', '9oi3', '9oum', '9oun', '9ouo', '9oup', '9ouq', '9our', '9ov4', '9pqs', '9psn', '9pso', '9psp', '9qrv', '9qtn', '9qto', '9ssm', '9th6', '9uaq', '9ubr', '9ucl', '9ugo', '9v0x', '9v1h', '9vjj', '9vwz', '9vz8', '9wey', '9wrn', '9ws0', '9wu2', '9xou', '9xqc', '9xqn', '9xsx', '9xth', '9y0a', '9y0d', '9y0e', '9yc5', '9yc6', '9yio', '9yy0', '9zwe', '9zz6'} | |
| OUT_DIR = "downloaded_missing_cifs" | |
| os.makedirs(OUT_DIR, exist_ok=True) | |
| def download_cif(pdb_id, out_dir=OUT_DIR): | |
| pdb_id = str(pdb_id).strip().upper() | |
| url = f"https://files.rcsb.org/download/{pdb_id}.cif" | |
| try: | |
| r = requests.get(url, timeout=30) | |
| if r.status_code == 200 and len(r.content) > 0: | |
| out_path = os.path.join(out_dir, f"{pdb_id}.cif") | |
| with open(out_path, "wb") as f: | |
| f.write(r.content) | |
| return True | |
| else: | |
| return False | |
| except requests.exceptions.RequestException: | |
| return False | |
| def main(missing_list): | |
| failed = [] | |
| for pid in missing_list: | |
| success = download_cif(pid) | |
| if not success: | |
| failed.append(pid) | |
| print("Total requested:", len(missing_list)) | |
| print("Downloaded CIF:", len(missing_list) - len(failed)) | |
| print("Failed:", len(failed)) | |
| if failed: | |
| print("Example failed:", failed[:10]) | |
| if __name__ == "__main__": | |
| missing_list = list(missing) # existing variable | |
| main(missing_list) | |
| # Download FASTA files for 111 missing CIFs | |
| BASE_DIR = "database/mmCIF_divided" | |
| OUT_DIR = "database/fasta_divided" | |
| for folder in os.listdir(BASE_DIR): | |
| folder_path = os.path.join(BASE_DIR, folder) | |
| if not os.path.isdir(folder_path): | |
| continue | |
| code = folder | |
| out_folder = os.path.join(OUT_DIR, code) | |
| os.makedirs(out_folder, exist_ok=True) | |
| for file in os.listdir(folder_path): | |
| if not file.endswith(".cif"): | |
| continue | |
| pdb_id = file.replace(".cif", "") | |
| url = f"https://www.rcsb.org/fasta/entry/{pdb_id}/display" | |
| out_path = os.path.join(out_folder, f"{pdb_id}.fasta") | |
| print(f"Downloading FASTA for {pdb_id}...") | |
| try: | |
| r = requests.get(url, timeout=30) | |
| if r.status_code == 200 and len(r.text) > 0: | |
| with open(out_path, "w") as f: | |
| f.write(r.text) | |
| else: | |
| print(f"Failed: {pdb_id}") | |
| except Exception as e: | |
| print(f"Error downloading {pdb_id}: {e}") | |
| time.sleep(0.5) |