Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove files before writing lib (custom kinfraglib) #74

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
337 changes: 0 additions & 337 deletions data/fragment_library_custom_filtered/B2.sdf

This file was deleted.

8 changes: 8 additions & 0 deletions kinfraglib/filters/retro.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import multiprocessing as mp
import os
import pandas as pd
import requests
import redo
Expand Down Expand Up @@ -1387,6 +1388,13 @@ def save_fragment_library_to_sdfs(path_output, fragment_library_concat):
path_output = Path(path_output)
path_output.mkdir(parents=True, exist_ok=True)

subpockets = ["AP", "SE", "FP", "GA", "B1", "B2", "X"]
# remove all {subpocket}.sdf files before writing to avoid death files
for subpocket in subpockets:
# check if files {subpocket}.sdf exists
if (path_output / f"{subpocket}.sdf").exists():
os.remove(path_output / f"{subpocket}.sdf")

for subpocket, fragments in fragment_library_concat.groupby("subpocket"):
with Chem.SDWriter(str(path_output / f"{subpocket}.sdf")) as w:
for mol in fragments.ROMol_original:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1245,8 +1245,8 @@
"Checking if all fragment pairs were requested..\n",
"All fragment pairs were requested.\n",
"Done.\n",
"CPU times: user 9min 37s, sys: 4.41 s, total: 9min 41s\n",
"Wall time: 11min 50s\n"
"CPU times: user 12min 9s, sys: 6.03 s, total: 12min 15s\n",
"Wall time: 15min 43s\n"
]
}
],
Expand Down Expand Up @@ -3289,7 +3289,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.19"
"version": "3.8.undefined"
}
},
"nbformat": 4,
Expand Down
Loading
Loading