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

Backmerge: #2433 - Issues with Saving and Opening Structures with Multi-Tailed Arrow in CDX and CDXML Formats #2521

Merged
merged 5 commits into from
Oct 9, 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
11 changes: 11 additions & 0 deletions api/tests/integration/ref/formats/rdf_to_cdxml.py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*** RDF to CDXML ***
pathway1.cdxml:SUCCEED
pathway10.cdxml:SUCCEED
pathway2.cdxml:SUCCEED
pathway3.cdxml:SUCCEED
pathway4.cdxml:SUCCEED
pathway5.cdxml:SUCCEED
pathway6.cdxml:SUCCEED
pathway7.cdxml:SUCCEED
pathway8.cdxml:SUCCEED
pathway9.cdxml:SUCCEED
59 changes: 59 additions & 0 deletions api/tests/integration/tests/formats/rdf_to_cdxml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
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 * # noqa

indigo = Indigo()
indigo.setOption("ignore-stereochemistry-errors", True)

print("*** RDF to CDXML ***")

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

files = [
"pathway1",
"pathway2",
"pathway3",
"pathway4",
"pathway5",
"pathway6",
"pathway7",
"pathway8",
"pathway9",
"pathway10",
]

files.sort()
for filename in files:
try:
ket = indigo.loadReactionFromFile(
os.path.join(root, filename + ".rdf")
)
except IndigoException as e:
print(" %s" % (getIndigoExceptionText(e)))

cdxml_text = ket.cdxml()
# with open(os.path.join(ref_path, filename + ".cdxml"), "w") as file:
# file.write(cdxml_text)

with open(os.path.join(ref_path, filename) + ".cdxml", "r") as file:
cdxml_ref = file.read()

diff = find_diff(cdxml_ref, cdxml_text)
if not diff:
print(filename + ".cdxml:SUCCEED")
else:
print(filename + ".cdxml:FAILED")
print(diff)
155 changes: 155 additions & 0 deletions api/tests/integration/tests/formats/reactions/rdf/pathway1.rdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
$RDFILE 1
$RFMT
$RXN

-INDIGO- 0808240900

2 1
$MOL

-INDIGO-08082409002D

6 6 0 0 0 0 0 0 0 0999 V2000
0.0560 -6.4789 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.7863 -6.4784 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.9228 -5.9788 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.7863 -7.4794 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0560 -7.4839 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.9250 -7.9789 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
3 1 2 0 0 0 0
1 5 1 0 0 0 0
5 6 2 0 0 0 0
6 4 1 0 0 0 0
4 2 2 0 0 0 0
2 3 1 0 0 0 0
M END
$MOL

-INDIGO-08082409002D

5 5 0 0 0 0 0 0 0 0999 V2000
6.2577 -6.2569 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
6.7581 -7.7970 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
7.0674 -6.8507 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
5.7574 -7.7970 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
5.4480 -6.8507 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 5 1 0 0 0 0
5 4 2 0 0 0 0
4 2 1 0 0 0 0
2 3 2 0 0 0 0
3 1 1 0 0 0 0
M END
$MOL

-INDIGO-08082409002D

7 7 0 0 0 0 0 0 0 0999 V2000
12.1705 -6.6231 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
12.1705 -7.6231 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.0365 -8.1231 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.9026 -7.6231 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.9026 -6.6231 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.0365 -6.1231 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
14.7686 -6.1231 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
6 1 1 0 0 0 0
1 2 1 0 0 0 0
2 3 1 0 0 0 0
3 4 1 0 0 0 0
4 5 1 0 0 0 0
5 6 1 0 0 0 0
5 7 1 0 0 0 0
M END

$RFMT
$RXN

-INDIGO- 0809241137

3 1
$MOL

-INDIGO-08092411372D

7 7 0 0 0 0 0 0 0 0999 V2000
11.6489 -9.0554 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
11.6489 -10.0554 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
12.5149 -10.5554 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.3810 -10.0554 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.3810 -9.0554 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
12.5149 -8.5554 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
14.2470 -8.5554 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
6 1 1 0 0 0 0
1 2 1 0 0 0 0
2 3 1 0 0 0 0
3 4 1 0 0 0 0
4 5 1 0 0 0 0
5 6 1 0 0 0 0
5 7 1 0 0 0 0
M END
$MOL

-INDIGO-08092411372D

7 7 0 0 0 0 0 0 0 0999 V2000
19.5343 -8.8815 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
20.0347 -10.4216 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
20.3439 -9.4753 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
19.0339 -10.4216 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
18.7246 -9.4753 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
19.5343 -7.8815 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
20.5343 -7.8815 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 5 1 0 0 0 0
5 4 2 0 0 0 0
4 2 1 0 0 0 0
2 3 2 0 0 0 0
3 1 1 0 0 0 0
1 6 2 0 0 0 0
6 7 1 0 0 0 0
M END
$MOL

-INDIGO-08092411372D

8 8 0 0 0 0 0 0 0 0999 V2000
5.9649 -9.1617 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
6.7488 -8.5442 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
7.7218 -8.7667 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
8.1559 -9.6625 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
5.9704 -10.1689 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
7.7225 -10.5696 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
6.7488 -10.7921 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
4.9990 -8.9029 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
2 1 1 0 0 0 0
1 5 1 0 0 0 0
5 7 1 0 0 0 0
7 6 1 0 0 0 0
6 4 1 0 0 0 0
4 3 1 0 0 0 0
3 2 1 0 0 0 0
1 8 1 0 0 0 0
M END
$MOL

-INDIGO-08092411372D

9 9 0 0 0 0 0 0 0 0999 V2000
26.4095 -9.2478 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
28.1398 -9.2473 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
27.2763 -8.7477 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
28.1398 -10.2482 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
26.4095 -10.2527 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
27.2785 -10.7477 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
25.5435 -10.7527 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
26.5714 -11.4548 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
28.8469 -10.9553 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
3 1 2 0 0 0 0
1 5 1 0 0 0 0
5 6 2 0 0 0 0
6 4 1 0 0 0 0
4 2 2 0 0 0 0
2 3 1 0 0 0 0
5 7 1 0 0 0 0
6 8 2 0 0 0 0
4 9 1 0 0 0 0
M END

Loading
Loading