Skip to content

Commit

Permalink
rbc & subst -2 (#969)
Browse files Browse the repository at this point in the history
Co-authored-by: Roman Porozhnetov <roman_porozhnetov@epam.com>
  • Loading branch information
even1024 and even1024 authored Jan 6, 2023
1 parent 74faa93 commit 0031c1a
Show file tree
Hide file tree
Showing 3 changed files with 329 additions and 3 deletions.
272 changes: 271 additions & 1 deletion api/tests/integration/ref/formats/mol_features.py.out
Original file line number Diff line number Diff line change
Expand Up @@ -7652,7 +7652,154 @@ M END

OK
ind-288-queryfeats_twofragsV3000.mol:
molfile loader: Query substitution count as drawn is not supported yet (SUBST=-2)
molfile-saving-mode: auto

-INDIGO-01000000002D

0 0 0 0 0 0 0 0 0 0 0 V3000
M V30 BEGIN CTAB
M V30 COUNTS 17 17 0 0 0
M V30 BEGIN ATOM
M V30 1 C -1.25143 -1.17079 0.0 0
M V30 2 C -1.25259 -1.99816 0.0 0
M V30 3 C -0.537777 -2.41104 0.0 0
M V30 4 C 0.178667 -1.99769 0.0 0
M V30 5 C 0.17581 -1.16716 0.0 0
M V30 6 C -0.539582 -0.758027 0.0 0
M V30 7 N -0.542045 0.0669694 0.0 0 SUBST=-2
M V30 8 C -0.537978 -3.23604 0.0 0 RBCNT=3
M V30 9 C 3.8625 -1.175 0.0 0
M V30 10 C 3.8625 -2.0 0.0 0
M V30 11 C 4.57452 -2.40833 0.0 0 CFG=1
M V30 12 C 5.28654 -2.0 0.0 0 CFG=2
M V30 13 C 5.28654 -1.175 0.0 0
M V30 14 C 4.57452 -0.758333 0.0 0 CFG=2
M V30 15 C 4.57452 0.0666667 0.0 0
M V30 16 C 4.57452 -3.23333 0.0 0
M V30 17 C 6.00041 -2.41354 0.0 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 2 3 4
M V30 2 2 1 2
M V30 3 1 4 5
M V30 4 2 5 6
M V30 5 1 6 1
M V30 6 1 2 3
M V30 7 1 6 7
M V30 8 1 3 8
M V30 9 1 9 10
M V30 10 1 9 14
M V30 11 1 10 11
M V30 12 1 11 12
M V30 13 1 12 13
M V30 14 1 13 14
M V30 15 1 14 15 CFG=1
M V30 16 1 11 16 CFG=1
M V30 17 1 12 17 CFG=3
M V30 END BOND
M V30 BEGIN COLLECTION
M V30 MDLV30/STERAC1 ATOMS=(2 11 14)
M V30 MDLV30/STEABS ATOMS=(1 12)
M V30 END COLLECTION
M V30 END CTAB
M END

molfile-saving-mode: 2000

-INDIGO-01000000002D

17 17 0 0 0 0 0 0 0 0999 V2000
-1.2514 -1.1708 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2526 -1.9982 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.5378 -2.4110 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.1787 -1.9977 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.1758 -1.1672 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.5396 -0.7580 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.5420 0.0670 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
-0.5380 -3.2360 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
3.8625 -1.1750 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
3.8625 -2.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
4.5745 -2.4083 0.0000 C 0 0 1 0 0 0 0 0 0 0 0 0
5.2865 -2.0000 0.0000 C 0 0 2 0 0 0 0 0 0 0 0 0
5.2865 -1.1750 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
4.5745 -0.7583 0.0000 C 0 0 2 0 0 0 0 0 0 0 0 0
4.5745 0.0667 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
4.5745 -3.2333 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
6.0004 -2.4135 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
3 4 2 0 0 0 0
1 2 2 0 0 0 0
4 5 1 0 0 0 0
5 6 2 0 0 0 0
6 1 1 0 0 0 0
2 3 1 0 0 0 0
6 7 1 0 0 0 0
3 8 1 0 0 0 0
9 10 1 0 0 0 0
9 14 1 0 0 0 0
10 11 1 0 0 0 0
11 12 1 0 0 0 0
12 13 1 0 0 0 0
13 14 1 0 0 0 0
14 15 1 1 0 0 0
11 16 1 1 0 0 0
12 17 1 6 0 0 0
M SUB 1 7 -2
M RBC 1 8 3
M END

molfile-saving-mode: 3000

-INDIGO-01000000002D

0 0 0 0 0 0 0 0 0 0 0 V3000
M V30 BEGIN CTAB
M V30 COUNTS 17 17 0 0 0
M V30 BEGIN ATOM
M V30 1 C -1.25143 -1.17079 0.0 0
M V30 2 C -1.25259 -1.99816 0.0 0
M V30 3 C -0.537777 -2.41104 0.0 0
M V30 4 C 0.178667 -1.99769 0.0 0
M V30 5 C 0.17581 -1.16716 0.0 0
M V30 6 C -0.539582 -0.758027 0.0 0
M V30 7 N -0.542045 0.0669694 0.0 0 SUBST=-2
M V30 8 C -0.537978 -3.23604 0.0 0 RBCNT=3
M V30 9 C 3.8625 -1.175 0.0 0
M V30 10 C 3.8625 -2.0 0.0 0
M V30 11 C 4.57452 -2.40833 0.0 0 CFG=1
M V30 12 C 5.28654 -2.0 0.0 0 CFG=2
M V30 13 C 5.28654 -1.175 0.0 0
M V30 14 C 4.57452 -0.758333 0.0 0 CFG=2
M V30 15 C 4.57452 0.0666667 0.0 0
M V30 16 C 4.57452 -3.23333 0.0 0
M V30 17 C 6.00041 -2.41354 0.0 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 2 3 4
M V30 2 2 1 2
M V30 3 1 4 5
M V30 4 2 5 6
M V30 5 1 6 1
M V30 6 1 2 3
M V30 7 1 6 7
M V30 8 1 3 8
M V30 9 1 9 10
M V30 10 1 9 14
M V30 11 1 10 11
M V30 12 1 11 12
M V30 13 1 12 13
M V30 14 1 13 14
M V30 15 1 14 15 CFG=1
M V30 16 1 11 16 CFG=1
M V30 17 1 12 17 CFG=3
M V30 END BOND
M V30 BEGIN COLLECTION
M V30 MDLV30/STERAC1 ATOMS=(2 11 14)
M V30 MDLV30/STEABS ATOMS=(1 12)
M V30 END COLLECTION
M V30 END CTAB
M END

OK
ind-289-link_v3000.mol:
molfile loader: link nodes are not supported yet (M V30 LINKNODE 1 2 2 2 3 2 1)
ind-290-list2v2000.mol:
Expand Down Expand Up @@ -8683,6 +8830,129 @@ M V30 15 1 14 15
M V30 16 1 15 16
M V30 END BOND
M V30 END CTAB
M END

OK
ind-928-asdrawn.mol:
molfile-saving-mode: auto

-INDIGO-01000000002D

14 15 0 0 0 0 0 0 0 0999 V2000
12.4500 -4.8679 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
11.9500 -5.7340 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
12.4500 -6.5999 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.4500 -6.5999 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.9500 -5.7340 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.4500 -4.8679 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.9500 -7.4661 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
14.9500 -7.4661 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
15.4500 -6.6000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
14.9500 -5.7340 0.0000 C 0 0 0 3 0 0 0 0 0 0 0 0
16.4500 -6.6000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.4500 -8.3321 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
16.9500 -5.7340 0.0000 C 0 0 0 2 0 0 0 0 0 0 0 0
17.9500 -5.7340 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 6 1 0 0 0 0
1 2 1 0 0 0 0
2 3 1 0 0 0 0
3 4 2 0 0 0 0
4 5 1 0 0 0 0
5 6 1 0 0 0 0
4 7 1 0 0 0 0
7 8 1 0 0 0 0
8 9 1 0 0 0 0
9 10 1 0 0 0 0
10 5 1 0 0 0 0
9 11 1 0 0 0 0
7 12 1 0 0 0 0
11 13 2 0 0 0 0
13 14 1 0 0 0 0
M UNS 2 3 1 11 1
M SUB 2 4 3 5 4
M RBC 2 4 3 7 -2
M END

molfile-saving-mode: 2000

-INDIGO-01000000002D

14 15 0 0 0 0 0 0 0 0999 V2000
12.4500 -4.8679 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
11.9500 -5.7340 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
12.4500 -6.5999 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.4500 -6.5999 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.9500 -5.7340 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.4500 -4.8679 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.9500 -7.4661 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
14.9500 -7.4661 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
15.4500 -6.6000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
14.9500 -5.7340 0.0000 C 0 0 0 3 0 0 0 0 0 0 0 0
16.4500 -6.6000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
13.4500 -8.3321 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
16.9500 -5.7340 0.0000 C 0 0 0 2 0 0 0 0 0 0 0 0
17.9500 -5.7340 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 6 1 0 0 0 0
1 2 1 0 0 0 0
2 3 1 0 0 0 0
3 4 2 0 0 0 0
4 5 1 0 0 0 0
5 6 1 0 0 0 0
4 7 1 0 0 0 0
7 8 1 0 0 0 0
8 9 1 0 0 0 0
9 10 1 0 0 0 0
10 5 1 0 0 0 0
9 11 1 0 0 0 0
7 12 1 0 0 0 0
11 13 2 0 0 0 0
13 14 1 0 0 0 0
M UNS 2 3 1 11 1
M SUB 2 4 3 5 4
M RBC 2 4 3 7 -2
M END

molfile-saving-mode: 3000

-INDIGO-01000000002D

0 0 0 0 0 0 0 0 0 0 0 V3000
M V30 BEGIN CTAB
M V30 COUNTS 14 15 0 0 0
M V30 BEGIN ATOM
M V30 1 C 12.45 -4.86795 0.0 0
M V30 2 C 11.95 -5.73395 0.0 0
M V30 3 C 12.45 -6.59995 0.0 0 UNSAT=1
M V30 4 C 13.45 -6.59995 0.0 0 SUBST=3 RBCNT=3
M V30 5 C 13.95 -5.73395 0.0 0 SUBST=4
M V30 6 C 13.45 -4.86795 0.0 0
M V30 7 C 13.95 -7.46605 0.0 0 RBCNT=-2
M V30 8 C 14.95 -7.46605 0.0 0
M V30 9 C 15.45 -6.60005 0.0 0
M V30 10 C 14.95 -5.73395 0.0 0 HCOUNT=2
M V30 11 C 16.45 -6.60005 0.0 0 UNSAT=1
M V30 12 C 13.45 -8.33205 0.0 0
M V30 13 C 16.95 -5.73405 0.0 0 HCOUNT=1
M V30 14 C 17.95 -5.73405 0.0 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 6
M V30 2 1 1 2
M V30 3 1 2 3
M V30 4 2 3 4
M V30 5 1 4 5
M V30 6 1 5 6
M V30 7 1 4 7
M V30 8 1 7 8
M V30 9 1 8 9
M V30 10 1 9 10
M V30 11 1 10 5
M V30 12 1 9 11
M V30 13 1 7 12
M V30 14 2 11 13
M V30 15 1 13 14
M V30 END BOND
M V30 END CTAB
M END

OK
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

-INDIGO-12122214002D

0 0 0 0 0 0 0 0 0 0 0 V3000
M V30 BEGIN CTAB
M V30 COUNTS 14 15 0 0 0
M V30 BEGIN ATOM
M V30 1 C 12.45 -4.86795 0.0 0
M V30 2 C 11.95 -5.73395 0.0 0
M V30 3 C 12.45 -6.59995 0.0 0 UNSAT=1
M V30 4 C 13.45 -6.59995 0.0 0 SUBST=3 RBCNT=3
M V30 5 C 13.95 -5.73395 0.0 0 SUBST=4
M V30 6 C 13.45 -4.86795 0.0 0
M V30 7 C 13.95 -7.46605 0.0 0 RBCNT=-2
M V30 8 C 14.95 -7.46605 0.0 0
M V30 9 C 15.45 -6.60005 0.0 0
M V30 10 C 14.95 -5.73395 0.0 0 HCOUNT=2
M V30 11 C 16.45 -6.60005 0.0 0 UNSAT=1
M V30 12 C 13.45 -8.33205 0.0 0
M V30 13 C 16.95 -5.73405 0.0 0 HCOUNT=1
M V30 14 C 17.95 -5.73405 0.0 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 6
M V30 2 1 1 2
M V30 3 1 2 3
M V30 4 2 3 4
M V30 5 1 4 5
M V30 6 1 5 6
M V30 7 1 4 7
M V30 8 1 7 8
M V30 9 1 8 9
M V30 10 1 9 10
M V30 11 1 10 5
M V30 12 1 9 11
M V30 13 1 7 12
M V30 14 2 11 13
M V30 15 1 13 14
M V30 END BOND
M V30 END CTAB
M END
19 changes: 17 additions & 2 deletions core/indigo-core/molecule/src/molfile_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2636,7 +2636,11 @@ void MolfileLoader::_readCtab3000()
if (subst == -1)
_qmol->resetAtom(i, QueryMolecule::Atom::und(_qmol->releaseAtom(i), new QueryMolecule::Atom(QueryMolecule::ATOM_SUBSTITUENTS, 0)));
else if (subst == -2)
throw Error("Query substitution count as drawn is not supported yet (SUBST=%d)", subst);
{
_qmol->resetAtom(
i, QueryMolecule::Atom::und(_qmol->releaseAtom(i),
new QueryMolecule::Atom(QueryMolecule::ATOM_SUBSTITUENTS_AS_DRAWN, _qmol->getVertex(i).degree())));
}
else if (subst > 0)
_qmol->resetAtom(i, QueryMolecule::Atom::und(_qmol->releaseAtom(i), new QueryMolecule::Atom(QueryMolecule::ATOM_SUBSTITUENTS, subst,
(subst < 6 ? subst : 100))));
Expand Down Expand Up @@ -2674,8 +2678,19 @@ void MolfileLoader::_readCtab3000()
{
if (rb == -1)
rb = 0;
else if (rb == -2)
{
int k, rbonds = 0;
const Vertex& vertex = _qmol->getVertex(i);

if (rb > 1)
for (k = vertex.neiBegin(); k != vertex.neiEnd(); k = vertex.neiNext(k))
if (_qmol->getEdgeTopology(vertex.neiEdge(k)) == TOPOLOGY_RING)
rbonds++;

_qmol->resetAtom(i, QueryMolecule::Atom::und(_qmol->releaseAtom(i),
new QueryMolecule::Atom(QueryMolecule::ATOM_RING_BONDS_AS_DRAWN, rbonds)));
}
else if (rb > 1)
_qmol->resetAtom(i, QueryMolecule::Atom::und(_qmol->releaseAtom(i),
new QueryMolecule::Atom(QueryMolecule::ATOM_RING_BONDS, rb, (rb < 4 ? rb : 100))));
else
Expand Down

0 comments on commit 0031c1a

Please sign in to comment.