Skip to content

Commit

Permalink
Adding SDF export (slow)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adafede committed Nov 23, 2023
1 parent 49b9d74 commit 54c7783
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions update/generate_database_chemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ def run(root: Path) -> None:
"tc2r": tc2r,
}

print(f"Exporting {len(mols_h)} to SDF...takes long")
# TODO Add additional metadata in the SDF if needed. Rawer as raw for now
with Chem.SDWriter("data/lotus.sdf") as w:
for i in range(len(mols_h)):
mol = mols_h.GetMol(i)
if mol is not None:
w.write(mol)
print("Finished exporting")

with open(root / "database_chemo.pkl", "wb") as f:
pickle.dump(database, f)
print("Finished dumping")
Expand Down

0 comments on commit 54c7783

Please sign in to comment.