Skip to content

Commit

Permalink
#1349 Symbol for topology chain is missing in SMARTS file (#1354)
Browse files Browse the repository at this point in the history
  • Loading branch information
AliaksandrDziarkach authored Oct 19, 2023
1 parent 4369a05 commit 2e0b7ae
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/tests/integration/ref/deco/deco_recursive_smarts.py.out
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ full scaffold:
0.0000 0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 0.0000 0.0000 R# 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 0.0000 0.0000 R# 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
2 3 1 0 0 0 0
1 2 1 0 0 2 0
2 3 1 0 0 2 0
3 4 2 0 0 0 0
5 2 1 0 0 0 0
6 4 1 0 0 0 0
Expand Down
6 changes: 6 additions & 0 deletions api/tests/integration/ref/formats/smarts.py.out
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ CC[C+5]CCCCC
[C;@@] is ok. smarts_in==smarts_out
[C;@@] is ok. json_in==json_out
[C;@@] is ok. expected string found in json
[#6]-;@[#6] is ok. smarts_in==smarts_out
[#6]-;@[#6] is ok. json_in==json_out
[#6]-;@[#6] is ok. expected string found in json
[#6]-;!@[#6] is ok. smarts_in==smarts_out
[#6]-;!@[#6] is ok. json_in==json_out
[#6]-;!@[#6] is ok. expected string found in json
6 changes: 6 additions & 0 deletions api/tests/integration/tests/formats/smarts.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,9 @@ def test_smarts_load_save_through_ket(smarts_in, expected_str):
"[C;@@]",
'"atoms":[{"label":"C","location":[0.0,0.0,0.0],"queryProperties":{"aromaticity":"aliphatic","chirality":"clockwise"}}]',
)
test_smarts_load_save_through_ket(
"[#6]-;@[#6]", '"bonds":[{"type":1,"topology":1,"atoms":[0,1]}]'
)
test_smarts_load_save_through_ket(
"[#6]-;!@[#6]", '"bonds":[{"type":1,"topology":2,"atoms":[0,1]}]'
)
2 changes: 2 additions & 0 deletions core/indigo-core/molecule/src/query_molecule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ void QueryMolecule::writeSmartsBond(Output& output, Bond* bond, bool has_or_pare
case BOND_TOPOLOGY: {
if (bond->value == TOPOLOGY_RING)
output.writeChar('@');
else
output.writeString("!@");
break;
}
default:
Expand Down
10 changes: 9 additions & 1 deletion core/indigo-core/molecule/src/smiles_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2631,7 +2631,15 @@ void SmilesLoader::_readBondSub(Array<char>& bond_str, _BondDesc& bond, std::uni
scanner.skip(1);
if (qbond.get() == 0)
throw Error("'@' ring bond is allowed only for queries");
topology = TOPOLOGY_RING;
if (neg)
{
topology = TOPOLOGY_CHAIN;
neg = false;
}
else
{
topology = TOPOLOGY_RING;
}
}
else
throw Error("Character #%d is unexpected during bond parsing", next);
Expand Down

0 comments on commit 2e0b7ae

Please sign in to comment.