Skip to content

Commit

Permalink
add test for ring detection (in progress)
Browse files Browse the repository at this point in the history
  • Loading branch information
diogomart committed May 4, 2022
1 parent a7c17fa commit 3e21ed0
Show file tree
Hide file tree
Showing 10 changed files with 503 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/ring_detection_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from meeko import MoleculePreparation
from rdkit import Chem
import pathlib

num_cycle_breaks = {
"adamantane": None,
"adamantane-stretched": None,
"cubane": None,
"oxabicyclo-2-2-2-octane": None,
"tricycle-6-5-5": None,
"tricycle-6-5-6": None,
"tricycle-6-5-6_B": None,
"tricycle-6-7-7": None,
}
workdir = pathlib.Path(__file__)
filenames = {name: str(workdir.parents[0] / "small_cycle_data" / ("%s.sdf" % name)) for name in num_cycle_breaks}
mk_prep = MoleculePreparation() #keep_equivalent_rings=True)

def run(molname):
filename = filenames[molname]
mol = Chem.MolFromMolFile(filename, removeHs=False)
mk_prep.prepare(mol)
setup = mk_prep.setup
print(molname)
for ring in setup.rings:
print("len=%d" % len(ring), ring)
print()

def test_all():
for molname in num_cycle_breaks:
run(molname)
61 changes: 61 additions & 0 deletions test/small_cycle_data/adamantane-stretched.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

RDKit 3D

27 29 0 0 0 0 0 0 0 0999 V2000
-0.3058 -0.8913 1.5297 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.0005 0.3575 1.0975 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.8160 0.1485 -0.1541 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.8461 -0.2650 -1.2490 C 0 0 0 0 0 0 0 0 0 0 0 0
0.1618 0.8038 -1.5027 C 0 0 0 0 0 0 0 0 0 0 0 0
0.9346 1.1803 -0.2759 C 0 0 0 0 0 0 0 0 0 0 0 0
2.0629 0.2693 0.0460 C 0 0 0 0 0 0 0 0 0 0 0 0
1.8181 -0.9865 0.3806 O 0 0 0 0 0 0 0 0 0 0 0 0
0.5709 -1.4856 0.4296 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.1721 -1.5365 -0.8749 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0075 1.4297 0.8789 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.1002 -1.6458 1.7716 H 0 0 0 0 0 0 0 0 0 0 0 0
0.2630 -0.7131 2.4368 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.6846 0.6664 1.8914 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.3869 1.0415 -0.3978 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.5272 -0.6772 0.0468 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.4416 -0.4247 -2.1544 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.3956 1.7232 -1.8510 H 0 0 0 0 0 0 0 0 0 0 0 0
0.7958 0.5046 -2.3388 H 0 0 0 0 0 0 0 0 0 0 0 0
1.3981 2.1881 -0.5080 H 0 0 0 0 0 0 0 0 0 0 0 0
2.6621 0.7707 0.8642 H 0 0 0 0 0 0 0 0 0 0 0 0
2.7677 0.2974 -0.8377 H 0 0 0 0 0 0 0 0 0 0 0 0
0.6779 -2.5731 0.7390 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.9751 -2.3227 -0.7741 H 0 0 0 0 0 0 0 0 0 0 0 0
0.5072 -1.8903 -1.6596 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.5546 2.3855 0.6609 H 0 0 0 0 0 0 0 0 0 0 0 0
0.5788 1.6453 1.8047 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
2 3 1 0
3 4 1 0
4 5 1 0
5 6 1 0
6 7 1 0
7 8 1 0
8 9 1 0
9 10 1 0
6 11 1 0
9 1 1 0
10 4 1 0
11 2 1 0
1 12 1 0
1 13 1 0
2 14 1 0
3 15 1 0
3 16 1 0
4 17 1 0
5 18 1 0
5 19 1 0
6 20 1 0
7 21 1 0
7 22 1 0
9 23 1 0
10 24 1 0
10 25 1 0
11 26 1 0
11 27 1 0
M END
59 changes: 59 additions & 0 deletions test/small_cycle_data/adamantane.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

RDKit 3D

26 28 0 0 0 0 0 0 0 0999 V2000
0.0185 0.6173 1.6071 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.0671 -0.2184 1.0393 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.4056 -1.5466 0.6370 C 0 0 0 0 0 0 0 0 0 0 0 0
0.5887 -1.2760 -0.4432 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0287 -0.5775 -1.6403 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.6698 0.6949 -1.2260 C 0 0 0 0 0 0 0 0 0 0 0 0
0.3417 1.6020 -0.5893 C 0 0 0 0 0 0 0 0 0 0 0 0
1.0787 0.9264 0.5449 C 0 0 0 0 0 0 0 0 0 0 0 0
1.6795 -0.3969 0.1377 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.7122 0.3153 -0.1943 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.2819 1.5422 2.0890 H 0 0 0 0 0 0 0 0 0 0 0 0
0.5625 -0.0243 2.3624 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.8405 -0.3721 1.8115 H 0 0 0 0 0 0 0 0 0 0 0 0
0.1704 -1.8563 1.5488 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.2129 -2.2263 0.3745 H 0 0 0 0 0 0 0 0 0 0 0 0
1.0318 -2.2294 -0.7804 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.5975 -1.2650 -2.2108 H 0 0 0 0 0 0 0 0 0 0 0 0
0.8800 -0.2779 -2.2885 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.1050 1.2169 -2.0835 H 0 0 0 0 0 0 0 0 0 0 0 0
1.0665 1.9373 -1.3292 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.2385 2.4433 -0.1166 H 0 0 0 0 0 0 0 0 0 0 0 0
1.8435 1.6024 0.9352 H 0 0 0 0 0 0 0 0 0 0 0 0
2.5365 -0.2844 -0.5524 H 0 0 0 0 0 0 0 0 0 0 0 0
2.0448 -0.8994 1.0440 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.4599 1.1011 -0.0271 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.2810 -0.5486 -0.6500 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
2 3 1 0
3 4 1 0
4 5 1 0
5 6 1 0
6 7 1 0
7 8 1 0
8 9 1 0
6 10 1 0
8 1 1 0
9 4 1 0
10 2 1 0
1 11 1 0
1 12 1 0
2 13 1 0
3 14 1 0
3 15 1 0
4 16 1 0
5 17 1 0
5 18 1 0
6 19 1 0
7 20 1 0
7 21 1 0
8 22 1 0
9 23 1 0
9 24 1 0
10 25 1 0
10 26 1 0
M END
41 changes: 41 additions & 0 deletions test/small_cycle_data/cubane.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

RDKit 3D

16 20 0 0 0 0 0 0 0 0999 V2000
-0.3684 0.4846 1.1206 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2636 -0.0934 0.1129 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.5514 0.6489 -0.9477 C 0 0 0 0 0 0 0 0 0 0 0 0
0.3407 1.2232 0.0829 C 0 0 0 0 0 0 0 0 0 0 0 0
1.2664 0.0872 -0.0990 C 0 0 0 0 0 0 0 0 0 0 0 0
0.5517 -0.6671 0.9343 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.3436 -1.2238 -0.0728 C 0 0 0 0 0 0 0 0 0 0 0 0
0.3672 -0.4602 -1.1297 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.6583 0.8485 2.0526 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.3000 -0.1651 0.1904 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.0204 1.2056 -1.6947 H 0 0 0 0 0 0 0 0 0 0 0 0
0.6314 2.2236 0.1174 H 0 0 0 0 0 0 0 0 0 0 0 0
2.3000 0.1713 -0.1891 H 0 0 0 0 0 0 0 0 0 0 0 0
0.9948 -1.1858 1.7232 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.6257 -2.2218 -0.1683 H 0 0 0 0 0 0 0 0 0 0 0 0
0.6793 -0.8760 -2.0330 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
2 3 1 0
3 4 1 0
4 5 1 0
5 6 1 0
6 7 1 0
7 8 1 0
4 1 1 0
6 1 1 0
7 2 1 0
8 3 1 0
8 5 1 0
1 9 1 0
2 10 1 0
3 11 1 0
4 12 1 0
5 13 1 0
6 14 1 0
7 15 1 0
8 16 1 0
M END
46 changes: 46 additions & 0 deletions test/small_cycle_data/oxabicyclo-2-2-2-octane.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

RDKit 3D

20 21 0 0 0 0 0 0 0 0999 V2000
-0.2987 -0.3295 1.2732 C 0 0 0 0 0 0 0 0 0 0 0 0
1.0615 -0.4629 1.2619 O 0 0 0 0 0 0 0 0 0 0 0 0
1.6543 -0.3302 0.0276 C 0 0 0 0 0 0 0 0 0 0 0 0
0.6177 0.2000 -0.9735 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0504 1.4451 -0.3548 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.6845 1.1147 0.9433 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.9960 -1.1782 0.2183 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.4038 -0.8978 -1.1401 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.6701 -0.6313 2.2727 H 0 0 0 0 0 0 0 0 0 0 0 0
2.4722 0.4397 0.0146 H 0 0 0 0 0 0 0 0 0 0 0 0
1.9821 -1.3024 -0.3769 H 0 0 0 0 0 0 0 0 0 0 0 0
1.0636 0.4415 -1.9402 H 0 0 0 0 0 0 0 0 0 0 0 0
0.9362 2.0685 -0.0359 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.5547 2.0515 -1.0334 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.7647 1.0980 0.7142 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.4072 1.7659 1.7676 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.9914 -2.2299 0.5026 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.0660 -0.8256 0.2219 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.1698 -0.6300 -1.8959 H 0 0 0 0 0 0 0 0 0 0 0 0
0.1689 -1.8069 -1.4674 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
2 3 1 0
3 4 1 0
4 5 1 0
5 6 1 0
1 7 1 0
7 8 1 0
8 4 1 0
6 1 1 0
1 9 1 0
3 10 1 0
3 11 1 0
4 12 1 0
5 13 1 0
5 14 1 0
6 15 1 0
6 16 1 0
7 17 1 0
7 18 1 0
8 19 1 0
8 20 1 0
M END
67 changes: 67 additions & 0 deletions test/small_cycle_data/tricycle-6-5-5.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

RDKit 3D

30 32 0 0 0 0 0 0 0 0999 V2000
-3.2119 -0.5011 -0.1166 O 0 0 0 0 0 0 0 0 0 0 0 0
-2.2046 -1.3907 0.1353 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.0196 -0.6788 0.6969 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.6261 0.3393 -0.3863 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.7059 1.3679 -0.3883 C 0 0 0 0 0 0 0 0 0 0 0 0
-2.9664 0.7972 0.2505 C 0 0 0 0 0 0 0 0 0 0 0 0
0.6964 0.7971 0.0905 C 0 0 0 0 0 0 0 0 0 0 0 0
1.2938 -0.3913 0.8336 C 0 0 0 0 0 0 0 0 0 0 0 0
0.2303 -1.4916 0.7564 C 0 0 0 0 0 0 0 0 0 0 0 0
2.5491 -0.7618 0.1193 C 0 0 0 0 0 0 0 0 0 0 0 0
2.9670 0.4760 -0.6656 C 0 0 0 0 0 0 0 0 0 0 0 0
1.6305 1.0346 -1.0810 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.8863 -1.8188 -0.8576 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.5196 -2.2709 0.7343 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.2069 -0.1805 1.6571 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.5609 -0.2236 -1.3298 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.9381 1.6136 -1.4535 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.4025 2.2245 0.2106 H 0 0 0 0 0 0 0 0 0 0 0 0
-3.8031 1.4206 -0.1460 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.9624 0.9492 1.3565 H 0 0 0 0 0 0 0 0 0 0 0 0
0.6739 1.7045 0.7229 H 0 0 0 0 0 0 0 0 0 0 0 0
1.4457 -0.0956 1.8905 H 0 0 0 0 0 0 0 0 0 0 0 0
0.2992 -2.1836 1.5967 H 0 0 0 0 0 0 0 0 0 0 0 0
0.3724 -1.9771 -0.2315 H 0 0 0 0 0 0 0 0 0 0 0 0
3.3320 -1.0068 0.8942 H 0 0 0 0 0 0 0 0 0 0 0 0
2.4546 -1.6491 -0.5097 H 0 0 0 0 0 0 0 0 0 0 0 0
3.5405 1.1476 -0.0099 H 0 0 0 0 0 0 0 0 0 0 0 0
3.5443 0.1497 -1.5554 H 0 0 0 0 0 0 0 0 0 0 0 0
1.6907 2.1230 -1.2463 H 0 0 0 0 0 0 0 0 0 0 0 0
1.2939 0.4766 -1.9680 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
2 3 1 0
3 4 1 0
4 5 1 0
5 6 1 0
4 7 1 0
7 8 1 0
8 9 1 0
8 10 1 0
10 11 1 0
11 12 1 0
6 1 1 0
9 3 1 0
12 7 1 0
2 13 1 0
2 14 1 0
3 15 1 0
4 16 1 0
5 17 1 0
5 18 1 0
6 19 1 0
6 20 1 0
7 21 1 0
8 22 1 0
9 23 1 0
9 24 1 0
10 25 1 0
10 26 1 0
11 27 1 0
11 28 1 0
12 29 1 0
12 30 1 0
M END
73 changes: 73 additions & 0 deletions test/small_cycle_data/tricycle-6-5-6.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

RDKit 3D

33 35 0 0 0 0 0 0 0 0999 V2000
3.5333 0.5725 0.0477 O 0 0 0 0 0 0 0 0 0 0 0 0
2.5800 1.0782 0.9267 C 0 0 0 0 0 0 0 0 0 0 0 0
1.2663 1.0490 0.2482 C 0 0 0 0 0 0 0 0 0 0 0 0
0.9356 -0.4331 -0.0173 C 0 0 0 0 0 0 0 0 0 0 0 0
1.9347 -0.9265 -0.9849 C 0 0 0 0 0 0 0 0 0 0 0 0
3.3155 -0.7098 -0.3561 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.4521 -0.2518 -0.5032 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.0193 0.5225 0.6987 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0856 1.4633 1.0471 C 0 0 0 0 0 0 0 0 0 0 0 0
-2.3022 1.1551 0.3184 C 0 0 0 0 0 0 0 0 0 0 0 0
-3.1187 0.1187 -0.4403 C 0 0 0 0 0 0 0 0 0 0 0 0
-2.6261 -1.2847 -0.1669 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2249 -1.4951 -0.7535 C 0 0 0 0 0 0 0 0 0 0 0 0
2.5933 0.5705 1.9082 H 0 0 0 0 0 0 0 0 0 0 0 0
2.8739 2.1368 1.1254 H 0 0 0 0 0 0 0 0 0 0 0 0
1.3556 1.5438 -0.7336 H 0 0 0 0 0 0 0 0 0 0 0 0
0.9460 -1.0025 0.9419 H 0 0 0 0 0 0 0 0 0 0 0 0
1.8490 -0.3951 -1.9319 H 0 0 0 0 0 0 0 0 0 0 0 0
1.8589 -2.0400 -1.1327 H 0 0 0 0 0 0 0 0 0 0 0 0
4.0433 -0.9605 -1.1421 H 0 0 0 0 0 0 0 0 0 0 0 0
3.4393 -1.4685 0.4492 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.4798 0.4535 -1.3602 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.1864 -0.1829 1.5307 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.2257 2.5106 0.7810 H 0 0 0 0 0 0 0 0 0 0 0 0
0.2836 1.5000 2.1460 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.1735 2.0452 -0.3443 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.8240 1.4840 1.2413 H 0 0 0 0 0 0 0 0 0 0 0 0
-3.0998 0.2847 -1.5322 H 0 0 0 0 0 0 0 0 0 0 0 0
-4.1463 0.1807 -0.0541 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.6531 -1.5666 0.8823 H 0 0 0 0 0 0 0 0 0 0 0 0
-3.2928 -1.9680 -0.7316 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.7662 -2.3455 -0.2412 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.3031 -1.6384 -1.8669 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
2 3 1 0
3 4 1 0
4 5 1 0
5 6 1 0
4 7 1 0
7 8 1 0
8 9 1 0
8 10 1 0
10 11 1 0
11 12 1 0
12 13 1 0
6 1 1 0
9 3 1 0
13 7 1 0
2 14 1 0
2 15 1 0
3 16 1 0
4 17 1 0
5 18 1 0
5 19 1 0
6 20 1 0
6 21 1 0
7 22 1 0
8 23 1 0
9 24 1 0
9 25 1 0
10 26 1 0
10 27 1 0
11 28 1 0
11 29 1 0
12 30 1 0
12 31 1 0
13 32 1 0
13 33 1 0
M END
Loading

0 comments on commit 3e21ed0

Please sign in to comment.