Skip to content
Open
Show file tree
Hide file tree
Changes from 12 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
37 changes: 37 additions & 0 deletions api/tests/integration/ref/formats/smiles.py.out
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ default smiles:
CCCCC |Sg:n:1,2,3::hh|
canonical smiles:
canonical SMILES saver: can not canonicalize a polymer
default smiles:
CCCC* |$;;;;_AP1$,Sg:n:2:2,6-7:ht|
canonical smiles:
canonical SMILES saver: can not canonicalize a polymer
default smiles:
CCCCC |SgD:1,2,3:a,b:c,d::: :|
canonical smiles:
CCCCC
default smiles:
CCCCC |SgD:1,2,3:name,&#59;:|{}$field:data,&#59;:|{}$value:query,&#59;:|{}$op:unit,&#59;:|{}$text: :|
canonical smiles:
CCCCC
default smiles:
CCCCC |Sg:n:1,2,3:sub,&#59;:|{}$script:hh|
canonical smiles:
canonical SMILES saver: can not canonicalize a polymer
daylight:
CCCC
daylight:
Expand All @@ -63,6 +79,14 @@ daylight:
SMILES saver: repeating units must have exactly two outgoing bonds, has 1
daylight:
CC{-}CC{+n}C
daylight:
CCC{-}{+n}C%91.[*:1]%91
daylight:
CCCCC
daylight:
CCCCC
daylight:
CC{-}CC{+n}C
chemaxon:
CCCC |Sg:gen:0,1,2:|
chemaxon:
Expand All @@ -71,6 +95,19 @@ chemaxon:
CCCC |Sg:n:0,1,2::ht|
chemaxon:
CCCCC |Sg:n:1,2,3::hh|
chemaxon:
CCCC* |$;;;;_AP1$,Sg:n:2:2,6-7:ht|
chemaxon:
CCCCC |SgD:1,2,3:a,b:c,d::: :|
chemaxon:
CCCCC |SgD:1,2,3:name,&#59;:|{}$field:data,&#59;:|{}$value:query,&#59;:|{}$op:unit,&#59;:|{}$text: :|
chemaxon:
CCCCC |Sg:n:1,2,3:sub,&#59;:|{}$script:hh|
*** S-Group AP closure roundtrip ***
chemaxon roundtrip:
CCCC* |$;;;;_AP1$,Sg:n:2:2,6-7:ht|
daylight closure:
CCC{-}{+n}C%91.[*:1]%91
*** Atropisomers ***
atropisomer:
C1=CC=C(C)C(C2=C(N)C=C(C)C=C2)=C1O |o1:5,r,wU:5.4|
Expand Down
3 changes: 3 additions & 0 deletions api/tests/integration/ref/formats/smiles_to_ket.py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*** SMILES to KET ***
sgroup_data_all_fields.ket:SUCCEED
sgroup_sru_subscript.ket:SUCCEED
101 changes: 101 additions & 0 deletions api/tests/integration/tests/formats/ref/sgroup_data_all_fields.ket
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"root": {
"nodes": [
{
"$ref": "mol0"
}
]
},
"mol0": {
"type": "molecule",
"atoms": [
{
"label": "C",
"location": [
-1.7320506572723389,
-5.960464477539063e-8,
0.0
]
},
{
"label": "C",
"location": [
-0.8660253882408142,
0.5,
0.0
]
},
{
"label": "C",
"location": [
0.0,
0.0,
0.0
]
},
{
"label": "C",
"location": [
0.866025447845459,
0.4999999701976776,
0.0
]
},
{
"label": "C",
"location": [
1.7320506572723389,
-2.980232238769531e-7,
0.0
]
}
],
"bonds": [
{
"type": 1,
"atoms": [
0,
1
]
},
{
"type": 1,
"atoms": [
1,
2
]
},
{
"type": 1,
"atoms": [
2,
3
]
},
{
"type": 1,
"atoms": [
3,
4
]
}
],
"sgroups": [
{
"type": "DAT",
"atoms": [
1,
2,
3
],
"fieldName": "name,;:|{}$field",
"fieldData": "data,;:|{}$value",
"fieldType": "unit,;:|{}$text",
"queryOp": "query,;:|{}$op",
"x": 1.9868215517249156e-8,
"y": 0.3333333432674408,
"dataDetached": false
}
]
}
}
96 changes: 96 additions & 0 deletions api/tests/integration/tests/formats/ref/sgroup_sru_subscript.ket
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"root": {
"nodes": [
{
"$ref": "mol0"
}
]
},
"mol0": {
"type": "molecule",
"atoms": [
{
"label": "C",
"location": [
-1.7320506572723389,
-5.960464477539063e-8,
0.0
]
},
{
"label": "C",
"location": [
-0.8660253882408142,
0.5,
0.0
]
},
{
"label": "C",
"location": [
0.0,
0.0,
0.0
]
},
{
"label": "C",
"location": [
0.866025447845459,
0.4999999701976776,
0.0
]
},
{
"label": "C",
"location": [
1.7320506572723389,
-2.980232238769531e-7,
0.0
]
}
],
"bonds": [
{
"type": 1,
"atoms": [
0,
1
]
},
{
"type": 1,
"atoms": [
1,
2
]
},
{
"type": 1,
"atoms": [
2,
3
]
},
{
"type": 1,
"atoms": [
3,
4
]
}
],
"sgroups": [
{
"type": "SRU",
"atoms": [
1,
2,
3
],
"subscript": "sub,;:|{}$script",
"connectivity": "HH"
}
]
}
}
24 changes: 24 additions & 0 deletions api/tests/integration/tests/formats/smiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,25 @@
print(getIndigoExceptionText(e))

print("*** S-Groups ***")
sgroup_data_all_fields = (
"CCCCC |SgD:1,2,3:"
"name,&#59;:|{}$field:"
"data,&#59;:|{}$value:"
"query,&#59;:|{}$op:"
"unit,&#59;:|{}$text: :|"
)
sgroup_sru_subscript = (
"CCCCC |Sg:n:1,2,3:sub,&#59;:|{}$script:hh|"
)
mols_smiles = [
"CCCC |Sg:gen:0,1,2:|",
"CCCC |Sg:n:0,1,2:3-6:eu|",
"CCCC |Sg:n:0,1,2::ht|",
"CCCCC |Sg:n:1,2,3::hh|",
"CCCC* |$;;;;_AP1$,Sg:n:2:2,6-7:ht|",
"CCCCC |SgD:1,2,3:a,b:c,d::: :|",
sgroup_data_all_fields,
sgroup_sru_subscript,
]
for sm in mols_smiles:
print("default smiles:")
Expand All @@ -120,6 +134,16 @@
print("chemaxon:")
print(indigo.loadMolecule(sm).smiles())

print("*** S-Group AP closure roundtrip ***")
sgroup_ap_closure = "CCCC* |$;;;;_AP1$,Sg:n:2:2,6-7:ht|"
indigo.setOption("smiles-saving-format", "chemaxon")
print("chemaxon roundtrip:")
print(indigo.loadMolecule(sgroup_ap_closure).smiles())
indigo.setOption("smiles-saving-format", "daylight")
print("daylight closure:")
print(indigo.loadMolecule(sgroup_ap_closure).smiles())
indigo.setOption("smiles-saving-format", "chemaxon")

print("*** Atropisomers ***")
mols_smiles = [
"C1C(O)=C(C2C=CC(C)=CC=2N)C(C)=CC=1 |o1:3,r,wU:3.12|",
Expand Down
36 changes: 36 additions & 0 deletions api/tests/integration/tests/formats/smiles_to_ket.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os
import sys

sys.path.append(
os.path.normpath(
os.path.join(os.path.abspath(__file__), "..", "..", "..", "common")
)
)
from common.util import compare_diff
from env_indigo import Indigo, joinPathPy # noqa

indigo = Indigo()
indigo.setOption("json-saving-pretty", True)

print("*** SMILES to KET ***")

ref_path = joinPathPy("ref/", __file__)

tests = [
(
"sgroup_data_all_fields",
"CCCCC |SgD:1,2,3:"
"name,&#59;:|{}$field:"
"data,&#59;:|{}$value:"
"query,&#59;:|{}$op:"
"unit,&#59;:|{}$text: :|",
),
(
"sgroup_sru_subscript",
"CCCCC |Sg:n:1,2,3:sub,&#59;:|{}$script:hh|",
),
]

for filename, smiles in tests:
ket = indigo.loadMolecule(smiles).json()
compare_diff(ref_path, filename + ".ket", ket)
Loading
Loading