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

#1183 Support monomer templates import from KET-format #1259

Closed
wants to merge 11 commits into from
Closed
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
6 changes: 6 additions & 0 deletions api/tests/integration/ref/formats/ket_to_mol.py.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
*** KET to MOL ***
all_templates.ket:SUCCEED
chem.ket:SUCCEED
cysteine.ket:SUCCEED
dcysteine.ket:SUCCEED
dthymine.ket:SUCCEED
suplabel.ket:SUCCEED
thymine.ket:SUCCEED
empty_apid.ket:SUCCEED
ket-reaction-arrow.ket:SUCCEED
6 changes: 6 additions & 0 deletions api/tests/integration/ref/formats/mol_to_ket.py.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
1046-imp_hydrogen.ket:SUCCEED
SgroupDifferent.ket:SUCCEED
atropisomer.ket:SUCCEED
chem.ket:SUCCEED
cysteine.ket:SUCCEED
dcysteine.ket:SUCCEED
dthymine.ket:SUCCEED
monomerTemplates.ket:SUCCEED
non_atrop.ket:SUCCEED
suplabel.ket:SUCCEED
thymine.ket:SUCCEED
18 changes: 16 additions & 2 deletions api/tests/integration/tests/formats/ket_to_mol.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,33 @@ def find_diff(a, b):
indigo = Indigo()
indigo.setOption("json-saving-pretty", True)
indigo.setOption("molfile-saving-skip-date", True)
indigo.setOption("molfile-saving-mode", "3000")

print("*** KET to MOL ***")

root = joinPathPy("molecules/", __file__)
ref_path = joinPathPy("ref/", __file__)
root_rea = joinPathPy("reactions/", __file__)

files = ["suplabel"]
files = [
"suplabel",
"cysteine",
"dcysteine",
"thymine",
"dthymine",
"chem",
"all_templates",
]

files.sort()
for filename in files:
mol = indigo.loadMoleculeFromFile(os.path.join(root, filename + ".ket"))
ket = mol.molfile()
# with open(os.path.join(ref_path, filename) + ".mol", "w") as file:
# file.write(ket)

with open(os.path.join(ref_path, filename) + ".mol", "r") as file:
ket_ref = file.read()
ket = mol.molfile()
diff = find_diff(ket_ref, ket)
if not diff:
print(filename + ".ket:SUCCEED")
Expand All @@ -42,6 +54,8 @@ def find_diff(a, b):
files = ["ket-reaction-arrow", "empty_apid"]

files.sort()
indigo.setOption("molfile-saving-mode", "2000")

for filename in files:
rc = indigo.loadReactionFromFile(os.path.join(root_rea, filename + ".ket"))
ket = rc.rxnfile()
Expand Down
6 changes: 6 additions & 0 deletions api/tests/integration/tests/formats/mol_to_ket.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def find_diff(a, b):
"suplabel",
"atropisomer",
"non_atrop",
"monomerTemplates",
"cysteine",
"dcysteine",
"thymine",
"dthymine",
"chem",
]

files.sort()
Expand Down
Loading
Loading