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

Fix ring hybridization filter #65

Merged
merged 3 commits into from
Nov 18, 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
5 changes: 3 additions & 2 deletions src/kartograf/filters/ring_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ def get_atom_ring_hybridization_map(rdmol: Chem.Mol) -> dict[int, bool]:
# Filtering Mapping
filtered_mapping = {}
for ai, aj in mapping.items():
ai_only_arom_sys = atomA_ring_hyb_map[ai]
aj_only_arom_sys = atomB_ring_hyb_map[aj]
# if the atom is not in a ring return False
ai_only_arom_sys = atomA_ring_hyb_map.get(ai, False)
aj_only_arom_sys = atomB_ring_hyb_map.get(aj, False)

if ai_only_arom_sys == aj_only_arom_sys:
filtered_mapping[ai] = aj
Expand Down
6 changes: 6 additions & 0 deletions src/kartograf/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,9 @@ def fused_ring_mols() -> tuple[SmallMoleculeComponent, SmallMoleculeComponent]:
mol_a, mol_b = [SmallMoleculeComponent.from_rdkit(m) for m in rd_mols]
mol_b_to_a = align_mol_shape(mol_b, ref_mol=mol_a)
return mol_a, mol_b_to_a

@pytest.fixture(scope="session")
def shp2_hybridization_ligands() -> tuple[SmallMoleculeComponent, SmallMoleculeComponent]:
with resources.files("kartograf.tests.data") as d:
mols = [SmallMoleculeComponent.from_sdf_file(str(f)) for f in [d / "lig_E6.sdf", d / "lig_E29.sdf"]]
return mols[0], mols[1]
241 changes: 241 additions & 0 deletions src/kartograf/tests/data/lig_E29.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@

RDKit 3D

47 49 0 0 0 0 0 0 0 0999 V2000
18.7754 40.1099 3.8002 H 0 0 0 0 0 0 0 0 0 0 0 0
18.6777 40.2314 4.8706 C 0 0 0 0 0 0 0 0 0 0 0 0
19.7468 40.6158 5.5946 C 0 0 0 0 0 0 0 0 0 0 0 0
21.0192 40.8818 4.9003 C 0 0 0 0 0 0 0 0 0 0 0 0
21.0171 41.8873 3.9945 N 0 0 0 0 0 0 0 0 0 0 0 0
22.1653 42.0916 3.3156 C 0 0 0 0 0 0 0 0 0 0 0 0
22.1055 42.8603 2.5624 H 0 0 0 0 0 0 0 0 0 0 0 0
23.3293 41.3033 3.5193 C 0 0 0 0 0 0 0 0 0 0 0 0
24.4899 41.4562 2.7256 N 0 0 0 0 0 0 0 0 0 0 0 0
24.8188 42.7417 2.1171 C 0 0 0 0 0 0 0 0 0 0 0 0
23.9776 43.4260 2.0503 H 0 0 0 0 0 0 0 0 0 0 0 0
25.1240 42.5624 1.0869 H 0 0 0 0 0 0 0 0 0 0 0 0
25.9528 43.4192 2.9002 C 0 0 0 0 0 0 0 0 0 0 0 0
25.5856 43.6625 3.8981 H 0 0 0 0 0 0 0 0 0 0 0 0
26.1980 44.3696 2.4255 H 0 0 0 0 0 0 0 0 0 0 0 0
27.2087 42.5229 3.0068 C 0 0 0 0 0 0 0 0 0 0 0 0
27.8970 42.3874 1.6345 C 0 0 0 0 0 0 0 0 0 0 0 0
27.2619 41.8998 0.8938 H 0 0 0 0 0 0 0 0 0 0 0 0
28.8113 41.7942 1.7084 H 0 0 0 0 0 0 0 0 0 0 0 0
28.1702 43.3626 1.2287 H 0 0 0 0 0 0 0 0 0 0 0 0
28.1742 43.1538 3.9230 N 0 0 0 0 0 0 0 0 0 0 0 0
27.7769 43.2322 4.8532 H 0 0 0 0 0 0 0 0 0 0 0 0
29.0207 42.6059 3.9644 H 0 0 0 0 0 0 0 0 0 0 0 0
26.7863 41.1434 3.5786 C 0 0 0 0 0 0 0 0 0 0 0 0
27.6286 40.4533 3.5771 H 0 0 0 0 0 0 0 0 0 0 0 0
26.4880 41.2540 4.6208 H 0 0 0 0 0 0 0 0 0 0 0 0
25.6075 40.5174 2.8072 C 0 0 0 0 0 0 0 0 0 0 0 0
25.3237 39.5633 3.2539 H 0 0 0 0 0 0 0 0 0 0 0 0
25.9197 40.2722 1.7921 H 0 0 0 0 0 0 0 0 0 0 0 0
23.3267 40.3222 4.4587 N 0 0 0 0 0 0 0 0 0 0 0 0
22.1821 40.1114 5.1371 C 0 0 0 0 0 0 0 0 0 0 0 0
22.2060 39.0712 6.0662 N 0 0 0 0 0 0 0 0 0 0 0 0
21.3655 38.7600 6.5286 H 0 0 0 0 0 0 0 0 0 0 0 0
23.0367 38.5080 6.2095 H 0 0 0 0 0 0 0 0 0 0 0 0
19.6371 40.8386 7.1028 C 0 0 0 0 0 0 0 0 0 0 0 0
20.1496 40.0245 7.6191 H 0 0 0 0 0 0 0 0 0 0 0 0
20.1702 41.7537 7.3603 H 0 0 0 0 0 0 0 0 0 0 0 0
18.1832 40.9556 7.5993 C 0 0 0 0 0 0 0 0 0 0 0 0
18.1577 40.8839 8.6877 H 0 0 0 0 0 0 0 0 0 0 0 0
17.7698 41.9259 7.3434 H 0 0 0 0 0 0 0 0 0 0 0 0
17.2981 39.8754 6.9782 C 0 0 0 0 0 0 0 0 0 0 0 0
16.2781 39.9423 7.3565 H 0 0 0 0 0 0 0 0 0 0 0 0
17.6808 38.9089 7.3029 H 0 0 0 0 0 0 0 0 0 0 0 0
17.3046 39.9236 5.4417 C 0 0 0 0 0 0 0 0 0 0 0 0
16.6078 40.6774 5.0802 H 0 0 0 0 0 0 0 0 0 0 0 0
16.9636 38.9714 5.0364 H 0 0 0 0 0 0 0 0 0 0 0 0
28.3916 44.0828 3.5817 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
2 44 1 0
2 3 2 0
3 4 1 0
3 35 1 0
4 31 1 0
4 5 2 0
5 6 1 0
6 7 1 0
6 8 2 0
8 9 1 0
8 30 1 0
9 27 1 0
9 10 1 0
10 11 1 0
10 12 1 0
10 13 1 0
13 14 1 0
13 15 1 0
13 16 1 0
16 17 1 0
16 21 1 0
16 24 1 0
17 18 1 0
17 19 1 0
17 20 1 0
21 22 1 0
21 23 1 0
21 47 1 0
24 25 1 0
24 26 1 0
24 27 1 0
27 28 1 0
27 29 1 0
30 31 2 0
31 32 1 0
32 33 1 0
32 34 1 0
35 36 1 0
35 37 1 0
35 38 1 0
38 39 1 0
38 40 1 0
38 41 1 0
41 42 1 0
41 43 1 0
41 44 1 0
44 45 1 0
44 46 1 0
M CHG 1 21 1
M END

> <atom.dprop.PartialCharge>
0.13163000139150213 -0.1050800031169932 -0.21353000608530451 0.31494998725804879 -0.58587998357859061 0.23794999512586187 0.035829996492000339 0.50832998546514108 -0.75827998128977225
0.19682000371369909 0.06843999567184042 0.06843999567184042 -0.10818000343885828 0.072059994365306607 0.072059994365306607 0.15586000474843573 -0.13655999508943964 0.080199999536605587
0.080199999536605587 0.080199999536605587 -0.85518998113718436 0.45449000390920236 0.45449000390920236 -0.10818000343885828 0.072059994365306607 0.072059994365306607 0.19682000371369909
0.06843999567184042 0.06843999567184042 -0.74010998216715262 0.57174998315724923 -0.93444997278299735 0.43125000389966561 0.43125000389966561 -0.032640001003412487 0.051699997659059284
0.051699997659059284 -0.078700000618366489 0.049989996279807804 0.049989996279807804 -0.078590000246433506 0.046179996605249164 0.046179996605249164 -0.059940001194147351
0.060529997374149082 0.060529997374149082 0.45449000390920236

> <b_lp_Chiralities_Consistent>
1

> <i_epik_Tot_Q>
1

> <i_epik_Tot_abs_Q>
1

> <i_f3d_flags>
0

> <i_i_glide_confnum>
19

> <i_i_glide_lignum>
17

> <i_i_glide_posenum>
7

> <i_i_glide_rotatable_bonds>
2

> <i_lp_mmshare_version>
53161

> <i_m_source_file_index>
17

> <ofe-name>
lig_E29

> <r_epik_Charging_Adjusted_Penalty>
0.013028700000000001

> <r_epik_Ionization_Penalty>
0.0133

> <r_epik_Ionization_Penalty_Charging>
0.0130

> <r_epik_Ionization_Penalty_Neutral>
0.0002

> <r_epik_State_Penalty>
-0.0000

> <r_i_docking_score>
-7.6957134029427996

> <r_i_glide_ecoul>
-11.862565994262701

> <r_i_glide_eff_state_penalty>
0

> <r_i_glide_einternal>
0.703849077224731

> <r_i_glide_emodel>
-89.9225863409645

> <r_i_glide_energy>
-57.240186691284201

> <r_i_glide_erotb>
0.43741369017076498

> <r_i_glide_esite>
0

> <r_i_glide_evdw>
-45.377620697021499

> <r_i_glide_gscore>
-7.6957134029427996

> <r_i_glide_hbond>
-0.43198977661645799

> <r_i_glide_ligand_efficiency>
-0.36646254299727599

> <r_i_glide_ligand_efficiency_ln>
-1.9027495882244501

> <r_i_glide_ligand_efficiency_sa>
-1.0110423685872401

> <r_i_glide_lipo>
-1.92524055991004

> <r_i_glide_metal>
0

> <r_i_glide_rewards>
-1.72763082259658

> <r_i_glide_rmsd>
0.098280273803711807

> <r_lp_Energy>
44.176299999999998

> <r_lp_tautomer_probability>
1

> <s_epik_cmdline>
J2VwaWtfcHl0aG9uJywgJy1waHQnLCAnMC4wJywgJy1waCcsICc3LjQnLCAnLXRuJywgJzgnLCAnLW1hJywgJzUwMCcsICctaW1hZScsICc8aW5maWxlLm1hZT4nLCAnLW9tYWUnLCAnPG91dGZpbGUubWFlPic=

> <s_epik_input>
W0NIMl0xW0NIMl1bQ0gyXVtDSDJdW0NIXT1DMWMybltjSF1jKG5jMltOSDJdKU4oW0NIMl1bQ0gyXTMpW0NIMl1bQ0gyXUMzKFtDSDNdKVtOSDJd

> <s_glide_core_constrain_type>
snapped_core_restrain

> <s_i_glide_gridfile>
glide-grid_SHP2-5EHR

> <s_lp_Force_Field>
S-OPLS

> <s_lp_Variant>
lig_E29-1

> <s_m_source_file>
ligprep_shp2.smi

$$$$
Loading
Loading