-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* ket commons * CIP * CIP * CIP int cast * tests split * clang fix * static fix * stack fix * stack fix * stack fix * python exception * python exception * python exception * python exception * stack fix * python format fix * test fix * multiple CIP fixes * wasm fix * black py fix * test fix * comment removed --------- Co-authored-by: Roman Porozhnetov <roman_porozhnetov@epam.com>
- Loading branch information
Showing
54 changed files
with
11,650 additions
and
81 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
api/tests/integration/ref/basic/ketfile_stereo_desc.py.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
1910.mol:SUCCEED | ||
C14_R_iso.mol:SUCCEED | ||
C14_R_iso_2.mol:SUCCEED | ||
CIP_issue.mol:SUCCEED | ||
P-9.5.2.2_ex3.mol:SUCCEED | ||
P-92.5.1.mol:SUCCEED | ||
P-92.5.3.mol:SUCCEED | ||
P-92.6.mol:SUCCEED | ||
P-92.6_2.mol:SUCCEED | ||
P-92.6_ex2.mol:SUCCEED | ||
P-92_2_1_1_3_ex1.mol:SUCCEED | ||
P-92_2_1_1_3_ex2.mol:SUCCEED | ||
P-92_2_1_2_1_ex1.mol:SUCCEED | ||
P-92_2_1_2_1_ex2.mol:SUCCEED | ||
P-92_2_1_2_1_ex3.mol:SUCCEED | ||
P-92_2_1_3_ex1.mol:SUCCEED | ||
P-92_2_1_3_ex2.mol:SUCCEED | ||
RS-symmetrical-structure.mol:SUCCEED | ||
RS.mol:SUCCEED | ||
RS_for_incorrect_valence.mol:SUCCEED | ||
S-R diff.mol:SUCCEED | ||
StereochemComplexTester_AllAbs.mol:SUCCEED | ||
all-trans-inositol.mol:SUCCEED | ||
atom_any.mol:SUCCEED | ||
cis.mol:SUCCEED | ||
different stereo 2.mol:SUCCEED | ||
different stereo 3.mol:SUCCEED | ||
different stereo 4.mol:SUCCEED | ||
different stereo 5.mol:SUCCEED | ||
different stereo.mol:SUCCEED | ||
ketcher.mol:SUCCEED | ||
stereo-different-ketcher-marvin.mol:SUCCEED | ||
stereo-different-ketcher-marvin2.mol:SUCCEED | ||
t4_R.mol:SUCCEED | ||
t4_R_iso.mol:SUCCEED | ||
t4_S.mol:SUCCEED | ||
t4_S_iso.mol:SUCCEED | ||
trans.mol:SUCCEED | ||
without_stereo_label.mol:SUCCEED | ||
crazystereo.rxn:SUCCEED | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import difflib | ||
import os | ||
import sys | ||
|
||
|
||
def find_diff(a, b): | ||
return "\n".join(difflib.unified_diff(a.splitlines(), b.splitlines())) | ||
|
||
|
||
sys.path.append( | ||
os.path.normpath( | ||
os.path.join(os.path.abspath(__file__), "..", "..", "..", "common") | ||
) | ||
) | ||
|
||
from env_indigo import * | ||
|
||
threading.stack_size(2 * 1024 * 1024) | ||
|
||
|
||
def stereo_desc_test(py_file, out_queue): | ||
str_res = "" | ||
ref_path = joinPathPy("ref/", __file__) | ||
root = joinPathPy("molecules/CIP/", __file__) | ||
|
||
indigo = Indigo() | ||
indigo.setOption("json-saving-pretty", True) | ||
|
||
for filename in sorted(os.listdir(root)): | ||
ketfile = joinPathPy( | ||
os.path.join(ref_path, filename[:-4] + ".ket"), __file__ | ||
) | ||
mol = indigo.loadMoleculeFromFile(os.path.join(root, filename)) | ||
with open(ketfile, "r") as file: | ||
ket_ref = file.read() | ||
mol_json_no_cip = mol.json() | ||
indigo.setOption("json-saving-add-stereo-desc", True) | ||
mol_json_cip = mol.json() | ||
diff = find_diff(ket_ref, mol_json_cip) | ||
if not diff: | ||
diff = find_diff(mol_json_no_cip, mol_json_cip) | ||
indigo.setOption("json-saving-add-stereo-desc", False) | ||
mol = indigo.loadMoleculeFromFile( | ||
os.path.join(root, filename) | ||
) # reload to reset CIP | ||
if diff: | ||
diff = find_diff(mol.json(), mol_json_no_cip) | ||
if diff: | ||
str_res += ( | ||
"mismatch: json-saving-add-stereo-desc = false:\n" | ||
) | ||
else: | ||
# check conversion | ||
indigo.setOption("molfile-saving-add-stereo-desc", True) | ||
mol_cip = indigo.loadMolecule( | ||
mol.molfile() | ||
) # mol_cip should contain CIP as properties of atoms and bonds | ||
diff = find_diff( | ||
mol_cip.json(), mol_json_cip | ||
) # check if molecule has CIP | ||
if diff: | ||
str_res += "mismatch: molfile loader doesn't convert CIP SGroups:\n" | ||
else: | ||
str_res += filename + ":SUCCEED\n" | ||
continue | ||
str_res += filename + ":FAILED\n" | ||
str_res += diff + "\n" | ||
|
||
indigo.setOption("ignore-stereochemistry-errors", "true") | ||
filename = "crazystereo.rxn" | ||
|
||
rxn = indigo.loadReactionFromFile( | ||
os.path.join(joinPathPy("reactions/", __file__), filename) | ||
) | ||
|
||
ketfile = joinPathPy(os.path.join(ref_path, "crazystereo.ket"), __file__) | ||
with open(ketfile, "r") as file: | ||
ket_ref = file.read() | ||
diff = find_diff(ket_ref, rxn.json()) | ||
if not diff: | ||
str_res += filename + ":SUCCEED\n" | ||
else: | ||
str_res += filename + ":FAILED\n" | ||
str_res += diff + "\n" | ||
out_queue.put(str_res) | ||
|
||
|
||
if isJython(): | ||
from Queue import Queue | ||
else: | ||
from queue import Queue | ||
|
||
th_queue = Queue() | ||
test_thread = threading.Thread( | ||
target=stereo_desc_test, args=(os.path.abspath(__file__), th_queue) | ||
) | ||
test_thread.start() | ||
test_thread.join() | ||
print(th_queue.get()) |
Oops, something went wrong.