chython 2.4__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. chython/__init__.py +31 -0
  2. chython/_functions.py +69 -0
  3. chython/algorithms/__init__.py +18 -0
  4. chython/algorithms/_isomorphism.cp312-win_amd64.pyd +0 -0
  5. chython/algorithms/_isomorphism.pyx +189 -0
  6. chython/algorithms/aromatics/__init__.py +27 -0
  7. chython/algorithms/aromatics/_rules.py +124 -0
  8. chython/algorithms/aromatics/kekule.py +530 -0
  9. chython/algorithms/aromatics/test/__init__.py +18 -0
  10. chython/algorithms/aromatics/test/test_kekule.py +160 -0
  11. chython/algorithms/aromatics/test/test_thiele.py +263 -0
  12. chython/algorithms/aromatics/thiele.py +226 -0
  13. chython/algorithms/calculate2d/__init__.py +23 -0
  14. chython/algorithms/calculate2d/clean2d.js +1 -0
  15. chython/algorithms/calculate2d/molecule.py +149 -0
  16. chython/algorithms/calculate2d/reaction.py +80 -0
  17. chython/algorithms/depict.py +523 -0
  18. chython/algorithms/fingerprints/__init__.py +48 -0
  19. chython/algorithms/fingerprints/linear.py +208 -0
  20. chython/algorithms/fingerprints/morgan.py +137 -0
  21. chython/algorithms/fingerprints/test/__init__.py +18 -0
  22. chython/algorithms/fingerprints/test/test_linear.py +127 -0
  23. chython/algorithms/fingerprints/test/test_morgan.py +79 -0
  24. chython/algorithms/isomorphism.py +667 -0
  25. chython/algorithms/mapping/__init__.py +28 -0
  26. chython/algorithms/mapping/_groups.py +94 -0
  27. chython/algorithms/mapping/_reactions.py +72 -0
  28. chython/algorithms/mapping/attention.py +216 -0
  29. chython/algorithms/mapping/fixmapper.py +84 -0
  30. chython/algorithms/mapping/groups.py +137 -0
  31. chython/algorithms/mcs.py +202 -0
  32. chython/algorithms/morgan.py +82 -0
  33. chython/algorithms/rings.py +551 -0
  34. chython/algorithms/smiles.py +556 -0
  35. chython/algorithms/standardize/__init__.py +30 -0
  36. chython/algorithms/standardize/_charged.py +115 -0
  37. chython/algorithms/standardize/_groups.py +926 -0
  38. chython/algorithms/standardize/_metal_organics.py +189 -0
  39. chython/algorithms/standardize/_reagents.py +44 -0
  40. chython/algorithms/standardize/_salts.py +68 -0
  41. chython/algorithms/standardize/molecule.py +479 -0
  42. chython/algorithms/standardize/reaction.py +429 -0
  43. chython/algorithms/standardize/resonance.py +196 -0
  44. chython/algorithms/standardize/salts.py +128 -0
  45. chython/algorithms/standardize/saturation.py +378 -0
  46. chython/algorithms/standardize/test/__init__.py +18 -0
  47. chython/algorithms/standardize/test/test_groups.py +118 -0
  48. chython/algorithms/stereo.py +1222 -0
  49. chython/algorithms/tautomers/__init__.py +171 -0
  50. chython/algorithms/tautomers/_acid.py +59 -0
  51. chython/algorithms/tautomers/_base.py +116 -0
  52. chython/algorithms/tautomers/_keto_enol.py +107 -0
  53. chython/algorithms/tautomers/acid_base.py +214 -0
  54. chython/algorithms/tautomers/heteroarenes.py +108 -0
  55. chython/algorithms/tautomers/keto_enol.py +148 -0
  56. chython/algorithms/tautomers/test/__init__.py +18 -0
  57. chython/algorithms/tautomers/test/test_tautomers.py +80 -0
  58. chython/algorithms/test/__init__.py +18 -0
  59. chython/algorithms/test/test_isomorphism.py +58 -0
  60. chython/algorithms/test/test_smiles.py +76 -0
  61. chython/algorithms/x3dom.py +355 -0
  62. chython/containers/__init__.py +43 -0
  63. chython/containers/_pack_v2.cp312-win_amd64.pyd +0 -0
  64. chython/containers/_pack_v2.pyx +271 -0
  65. chython/containers/_unpack_v0v2.cp312-win_amd64.pyd +0 -0
  66. chython/containers/_unpack_v0v2.pyx +300 -0
  67. chython/containers/bonds.py +255 -0
  68. chython/containers/cgr.py +115 -0
  69. chython/containers/graph.py +200 -0
  70. chython/containers/molecule.py +695 -0
  71. chython/containers/query.py +66 -0
  72. chython/containers/reaction.py +324 -0
  73. chython/exceptions.py +114 -0
  74. chython/files/MRVrw.py +523 -0
  75. chython/files/PDBrw.py +257 -0
  76. chython/files/RDFrw.py +298 -0
  77. chython/files/SDFrw.py +221 -0
  78. chython/files/__init__.py +29 -0
  79. chython/files/_convert.py +207 -0
  80. chython/files/_mapping.py +117 -0
  81. chython/files/_xyz.cp312-win_amd64.pyd +0 -0
  82. chython/files/_xyz.pyx +74 -0
  83. chython/files/daylight/__init__.py +24 -0
  84. chython/files/daylight/parser.py +157 -0
  85. chython/files/daylight/smarts.py +107 -0
  86. chython/files/daylight/smiles.py +245 -0
  87. chython/files/daylight/test/__init__.py +18 -0
  88. chython/files/daylight/test/test_daylight_smarts.py +289 -0
  89. chython/files/daylight/test/test_daylight_smiles.py +101 -0
  90. chython/files/daylight/test/test_parser.py +118 -0
  91. chython/files/daylight/test/test_tokenize.py +77 -0
  92. chython/files/daylight/tokenize.py +376 -0
  93. chython/files/libinchi/__init__.py +22 -0
  94. chython/files/libinchi/libinchi.dll +0 -0
  95. chython/files/libinchi/wrapper.py +555 -0
  96. chython/files/mdl/__init__.py +25 -0
  97. chython/files/mdl/emol.py +209 -0
  98. chython/files/mdl/erxn.py +67 -0
  99. chython/files/mdl/mol.py +144 -0
  100. chython/files/mdl/read.py +225 -0
  101. chython/files/mdl/rxn.py +67 -0
  102. chython/files/mdl/stereo.py +63 -0
  103. chython/files/mdl/write.py +165 -0
  104. chython/files/xyz.py +78 -0
  105. chython/periodictable/__init__.py +69 -0
  106. chython/periodictable/base/__init__.py +25 -0
  107. chython/periodictable/base/dynamic.py +149 -0
  108. chython/periodictable/base/element.py +452 -0
  109. chython/periodictable/base/groups.py +90 -0
  110. chython/periodictable/base/periods.py +46 -0
  111. chython/periodictable/base/query.py +473 -0
  112. chython/periodictable/base/vector.py +119 -0
  113. chython/periodictable/groupI.py +252 -0
  114. chython/periodictable/groupII.py +223 -0
  115. chython/periodictable/groupIII.py +1154 -0
  116. chython/periodictable/groupIV.py +210 -0
  117. chython/periodictable/groupIX.py +196 -0
  118. chython/periodictable/groupV.py +192 -0
  119. chython/periodictable/groupVI.py +183 -0
  120. chython/periodictable/groupVII.py +162 -0
  121. chython/periodictable/groupVIII.py +161 -0
  122. chython/periodictable/groupX.py +166 -0
  123. chython/periodictable/groupXI.py +164 -0
  124. chython/periodictable/groupXII.py +158 -0
  125. chython/periodictable/groupXIII.py +239 -0
  126. chython/periodictable/groupXIV.py +262 -0
  127. chython/periodictable/groupXV.py +276 -0
  128. chython/periodictable/groupXVI.py +457 -0
  129. chython/periodictable/groupXVII.py +324 -0
  130. chython/periodictable/groupXVIII.py +260 -0
  131. chython/reactor/__init__.py +24 -0
  132. chython/reactor/base.py +212 -0
  133. chython/reactor/deprotection.py +565 -0
  134. chython/reactor/groups.py +128 -0
  135. chython/reactor/reactions/__init__.py +157 -0
  136. chython/reactor/reactions/_amidation.py +58 -0
  137. chython/reactor/reactions/_amine_isocyanate.py +52 -0
  138. chython/reactor/reactions/_buchwald_hartwig.py +50 -0
  139. chython/reactor/reactions/_esterification.py +49 -0
  140. chython/reactor/reactions/_macmillan.py +43 -0
  141. chython/reactor/reactions/_reductive_amination.py +50 -0
  142. chython/reactor/reactions/_sonogashira.py +49 -0
  143. chython/reactor/reactions/_sulfonamidation.py +52 -0
  144. chython/reactor/reactions/_suzuki_miyaura.py +88 -0
  145. chython/reactor/reactions/ufe.py +99 -0
  146. chython/reactor/reactor.py +170 -0
  147. chython/reactor/retro/__init__.py +77 -0
  148. chython/reactor/retro/_amidation.py +39 -0
  149. chython/reactor/retro/_aryl_amination.py +32 -0
  150. chython/reactor/retro/_mitsunobu.py +49 -0
  151. chython/reactor/retro/_sonogashira.py +49 -0
  152. chython/reactor/retro/_suzuki_miyaura.py +54 -0
  153. chython/reactor/scaffold.py +122 -0
  154. chython/reactor/test/__init__.py +18 -0
  155. chython/reactor/test/test_deprotection.py +57 -0
  156. chython/reactor/test/test_reactor.py +40 -0
  157. chython/reactor/test/test_scaffold.py +57 -0
  158. chython/reactor/test/test_transformer.py +40 -0
  159. chython/reactor/transformer.py +62 -0
  160. chython/utils/__init__.py +57 -0
  161. chython/utils/free_wilson.py +114 -0
  162. chython/utils/grid.py +130 -0
  163. chython/utils/rdkit.py +165 -0
  164. chython/utils/retro.py +139 -0
  165. chython/utils/svg.py +57 -0
  166. chython/utils/test/__init__.py +18 -0
  167. chython/utils/test/test_rdkit.py +71 -0
  168. chython-2.4.dist-info/LICENSE +165 -0
  169. chython-2.4.dist-info/METADATA +101 -0
  170. chython-2.4.dist-info/RECORD +171 -0
  171. chython-2.4.dist-info/WHEEL +4 -0
@@ -0,0 +1,565 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright 2022-2024 Ramil Nugmanov <nougmanoff@protonmail.com>
4
+ # This file is part of chython.
5
+ #
6
+ # chython is free software; you can redistribute it and/or modify
7
+ # it under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation; either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public License
17
+ # along with this program; if not, see <https://www.gnu.org/licenses/>.
18
+ #
19
+ from .. import smarts, MoleculeContainer
20
+ from .transformer import Transformer
21
+
22
+ """
23
+ Predefined transformers for most common protection groups cleavage.
24
+ """
25
+
26
+ _alcohol_thiocarbamate = ( # NaIO4 or H2O2/NaOH
27
+ ('[C;D2,D3,D4;z1;x1:1][O:2]C(=[S;D1])N([C;D1])[C;D1]', '[A:1][A:2]', # rule
28
+ 'CC(C)OC(=S)N(C)C', 'CC(C)O'), # test
29
+ )
30
+
31
+ _alcohol_fmoc = ( # Et3N pKa ~ 10
32
+ ('[C;D2,D3,D4;z1;x1:1][O:2]C(=O)O[C;D2][C;D3]1C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:C:2-C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:C1:3', # noqa
33
+ '[A:1][A:2]',
34
+ 'CC(C)OC(=O)OCC1C2=CC=CC=C2C2=C1C=CC=C2', 'CC(C)O'),
35
+ )
36
+
37
+ _alcohol_troc = ( # [Zn]
38
+ ('[C;D2,D3,D4;z1;x1:1][O:2]C(=O)O[C;D2]C([Cl;D1])([Cl;D1])[Cl;D1]', '[A:1][A:2]',
39
+ 'CC(C)OC(=O)OCC(Cl)(Cl)Cl', 'CC(C)O'),
40
+ )
41
+
42
+ _alcohol_teoc = ( # [F-]
43
+ ('[C;D2,D3,D4;z1;x1:1][O:2]C(=O)O[C;D2][C;D2][Si]([C;D1])([C;D1])[C;D1]', '[A:1][A:2]',
44
+ 'CC(C)OC(=O)OCC[Si](C)(C)C', 'CC(C)O'),
45
+ )
46
+
47
+ _alcohol_alloc = ( # [Pd] + NuH
48
+ ('[C;D2,D3,D4;z1;x1:1][O:2]C(=O)O[C;D2][C;D2]=[C;D1]', '[A:1][A:2]',
49
+ 'CC(C)OC(=O)OCC=C', 'CC(C)O'),
50
+ )
51
+
52
+ _alcohol_allyl = ( # basic or Metal isomerization + hydrolysis
53
+ ('[C;D2,D3,D4;z1;x1:1][O:2][C;D2][C;D2]=[C;D1]', '[A:1][A:2]',
54
+ 'CC(C)OCC=C', 'CC(C)O'),
55
+ )
56
+
57
+ _alcohol_silyl = ( # TMS TES TBS TBDMS TIPS TBDPS: [F-] ion substitution
58
+ ('[C;D2,D3,D4;z1;x1:1][O:2][Si;D4;z1;x1]', '[A:1][A:2]',
59
+ 'CC(C)O[Si](C)(C)CC', 'CC(C)O', 'CC(C)O[SiH](C)C', 'CC(C)O[Si](C)(C)OC'),
60
+ )
61
+
62
+ _alcohol_benzyl = ( # [H], ...
63
+ ('[C;D2,D3,D4;z1;x1:1][O:2][C;D2]C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1][A:2]',
64
+ 'CC(C)OCc1ccccc1', 'CC(C)O', 'CC(C)OCc1cccc(C)c1', 'CC(C)OC(C)c1ccccc1'), # test + decoys
65
+ )
66
+
67
+ _alcohol_o_nitrobenzyl = ( # UV-light
68
+ ('[C;D2,D3,D4;z1;x1:1][O:2][C;D2,D3;z1;x1]C:1:C([N+](=O)[O-]):[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1][A:2]',
69
+ 'CC(C)OCc1c(N(=O)=O)cccc1', 'CC(C)O', 'CC(C)OC(OC)c1c(N(=O)=O)cccc1'),
70
+ )
71
+
72
+ _alcohol_methoxy_benzyl = ( # PMB or MPM
73
+ ('[C;D2,D3,D4;z1;x1:1][O:2][C;D2]C:1:[C;D2]:[C;D2]:C(O[C;D1]):[C;D2]:[C;D2]:1', '[A:1][A:2]',
74
+ 'CC(C)OCc1ccc(OC)cc1', 'CC(C)O', 'CC(C)OCc1ccc(OCC)cc1', 'CC(C)OCc1cc(OC)ccc1'),
75
+ )
76
+
77
+ _alcohol_bom = ( # like Bn
78
+ ('[C;D2,D3,D4;z1;x1:1][O:2][C;D2]O[C;D2]C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1][A:2]',
79
+ 'CC(C)OCOCc1ccccc1', 'CC(C)O'),
80
+ )
81
+
82
+ _alcohol_piv = (
83
+ ('[C;D2,D3,D4;z1;x1:1][O:2]C(=O)C([C;D1])([C;D1])[C;D1]', '[A:1][A:2]'), # Piv
84
+ )
85
+
86
+ _alcohol_methoxy_benzoate = (
87
+ ('[C;D2,D3,D4;z1;x1:1][O:2]C(=O)C:1:[C;D2]:[C;D2]:C(O[C;D1]):[C;D2]:[C;D2]:1', '[A:1][A:2]'), # pMeO-Bz
88
+ )
89
+
90
+ _alcohol_benzoate = (
91
+ ('[C;D2,D3,D4;z1;x1:1][O:2]C(=O)C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1][A:2]'), # Bz
92
+ )
93
+
94
+ _alcohol_acyl = (
95
+ ('[C;D2,D3,D4;z1;x1:1][O:2]C(=O)[C;D1]', '[A:1][A:2]'), # Ac
96
+ )
97
+
98
+ _alcohol_tfa = (
99
+ ('[C;D2,D3,D4;z1;x1:1][O:2]C(=O)C(F)(F)F', '[A:1][A:2]'), # TFA
100
+ )
101
+
102
+ _alcohol_mom = (
103
+ ('[C;D2,D3,D4;z1;x1:1][O:2][C;D2]O[C;D1]', '[A:1][A:2]'), # MOM
104
+ )
105
+
106
+ _alcohol_thp = (
107
+ ('[C;D2,D3,D4;z1;x1:1][O:2][C;D3]1[O][C;D2][C;D2][C;D2][C;D2]1', '[A:1][A:2]'), # THP
108
+ )
109
+
110
+ _alcohol_tritil = (
111
+ ('[C;D2,D3,D4;z1;x1:1][O:2]C(C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1)(C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2)C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:3', # noqa
112
+ '[A:1][A:2]'),
113
+ )
114
+
115
+ _alcohol_tbu = (
116
+ ('[C;D2,D3,D4;z1;x1;M][O:1]-C([C;D1])([C;D1])[C;D1]', '[A:1]'),
117
+ )
118
+
119
+ _alcohol_amide_acetone = ( # N1CCOC1
120
+ ('[O:1]1[C;x1;z1;M][C;x1;z1;M][N:2]([C;M]=[O;M])-C1([C;D1])[C;D1]',
121
+ '[A:1].[A:2]'),
122
+ )
123
+
124
+ _diol12_acetone = (
125
+ ('[C;D3,D4;z1;x1:1]1[O:2]C([C;D1])([C;D1])[O:3][C;z1;x1:4]1', '[A:3][A:4][A:1][A:2]'), # ketone
126
+ )
127
+
128
+ _diol12_formalin = (
129
+ ('[C;D3,D4;z1;x1:1]1[O:2][C;D2][O:3][C;z1;x1:4]1', '[A:3][A:4][A:1][A:2]'), # formaldehyde
130
+ )
131
+
132
+ _diol12_cyclopentanone = (
133
+ ('[C;D3,D4;z1;x1:1]1[O:2]C2([C;D2][C;D2][C;D2][C;D2]2)[O:3][C;z1;x1:4]1', '[A:3][A:4][A:1][A:2]'),
134
+ )
135
+
136
+ _diol12_cyclohexanone = (
137
+ ('[C;D3,D4;z1;x1:1]1[O:2]C2([C;D2][C;D2][C;D2][C;D2][C;D2]2)[O:3][C;z1;x1:4]1', '[A:3][A:4][A:1][A:2]'),
138
+ )
139
+
140
+ _diol12_diacetal = (
141
+ ('[C;D3,D4;z1;x1:1]1[O:2]-C([C;D1])(O[C;D1])-C([C;D1])(O[C;D1])-[O:3][C;z1;x1:4]1',
142
+ '[A:3][A:4][A:1][A:2]'),
143
+ )
144
+
145
+ _diol13_formalin = (
146
+ ('[C:5]1[C;D3,D4;z1;x1:1][O:2][C;D2][O:3][C;z1;x1:4]1', '[A:3][A:4][A:5][A:1][A:2]'), # formaldehyde
147
+ )
148
+
149
+ _diol13_acetone = (
150
+ ('[C:5]1[C;D3,D4;z1;x1:1][O:2]C([C;D1])([C;D1])[O:3][C;z1;x1:4]1', '[A:3][A:4][A:5][A:1][A:2]'),
151
+ )
152
+
153
+ _diol12_benzylidene = (
154
+ ('[C;D3,D4;z1;x1:1]1[O:2][C;D3](C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2)[O:3][C;z1;x1:4]1',
155
+ '[A:3][A:4][A:1][A:2]',
156
+ 'CC1COC(O1)c1ccccc1', 'CC(O)CO'),
157
+ )
158
+
159
+ _diol13_cyclopentanone = (
160
+ ('[C:5]1[C;D3,D4;z1;x1:1][O:2]C2([C;D2][C;D2][C;D2][C;D2]2)[O:3][C;z1;x1:4]1',
161
+ '[A:3][A:4][A:5][A:1][A:2]'),
162
+ )
163
+
164
+ _diol13_cyclohexanone = (
165
+ ('[C:5]1[C;D3,D4;z1;x1:1][O:2]C2([C;D2][C;D2][C;D2][C;D2][C;D2]2)[O:3][C;z1;x1:4]1',
166
+ '[A:3][A:4][A:5][A:1][A:2]'),
167
+ )
168
+
169
+ _diol13_diacetal = (
170
+ ('[C:5]1[C;D3,D4;z1;x1:1][O:2]-C([C;D1])(O[C;D1])-C([C;D1])(O[C;D1])-[O:3][C;z1;x1:4]1',
171
+ '[A:3][A:4][A:5][A:1][A:2]'),
172
+ )
173
+
174
+ _diol13_benzylidene = (
175
+ ('[C:5]1[C;D3,D4;z1;x1:1][O:2][C;D3](C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2)[O:3][C;z1;x1:4]1',
176
+ '[A:3][A:4][A:5][A:1][A:2]',
177
+ 'CC1CCOC(O1)c1ccccc1', 'CC(O)CCO'),
178
+ )
179
+
180
+ _carbonyl_dithiolane = ( # MeI - S methylation + hydrolysis
181
+ ('[C;D3,D4;z1;x2:1]1[S;D2:3][C;D2][C;D2][S;D2]1', '[A:1]=O'),
182
+ )
183
+
184
+ _carbonyl_dithiane = ( # MeI - S methylation + hydrolysis
185
+ ('[C;D3,D4;z1;x2:1]1[S;D2:3][C;D2][C;D2][C;D2][S;D2]1', '[A:1]=O'),
186
+ )
187
+
188
+ _carbonyl_dimethylsulfide = ( # MeI - S methylation + hydrolysis
189
+ ('[C;D3,D4;z1;x2:1]([S;D2:3][C;D1])[S;D2][C;D1]', '[A:1]=O'),
190
+ )
191
+
192
+ _carbonyl_dioxolane = (
193
+ ('[C;D3,D4;z1;x2:1]1[O;D2:3][C;D2][C;D2][O;D2]1', '[A:1]=O'),
194
+ )
195
+
196
+ _carbonyl_dioxane = (
197
+ ('[C;D3,D4;z1;x2:1]1[O;D2:3][C;D2][C;D2][C;D2][O;D2]1', '[A:1]=O'),
198
+ )
199
+
200
+ _carbonyl_dimethoxy = (
201
+ ('[C;D3,D4;z1;x2:1]([O;D2:3][C;D1])[O;D2][C;D1]', '[A:1]=O'),
202
+ )
203
+
204
+ _carboxyl_tbu = (
205
+ ('[C;D3;x2:1](=[O:2])[O:3]-C([C;D1])([C;D1])[C;D1]', '[A:1](=[A:2])[A:3]'),
206
+ )
207
+
208
+ _carboxyl_mpe = (
209
+ ('[C;D3;x2;M](=[O;M])[O:1]-C([C;D1])([C;D2][C;D1])[C;D2][C;D1]', '[A:1]'),
210
+ )
211
+
212
+ _carboxyl_methyl = (
213
+ ('[C;D3;x2:1](=[O:2])-[O:4]-[C;D1]', '[A:1](=[A:2])O'), # Me
214
+ )
215
+
216
+ _carboxyl_trifluoroethyl = (
217
+ ('[C;D3;x2:1](=[O:2])-[O:4]-[C;D2]C(F)(F)F', '[A:1](=[A:2])O'), # CF3-CH2-
218
+ )
219
+
220
+ _carboxyl_trioxabicyclooctane = ( # [H+]. Note! second step of basic hydrolysis required.
221
+ ('[C;D4;x3:1]12[O:4][C;D2]C([C;D1])([C;D2]O1)[C;D2]O2', '[A:1](=O)O',
222
+ 'CC(C)C12OCC(C)(CO1)CO2', 'CC(C)C(O)=O', 'CC(C)C12OCC(CC)(CO1)CO2', 'CC(C)C12OC(C)C(C)(CO1)CO2'),
223
+ )
224
+
225
+ _carboxyl_allyl = ( # [Pd] + NuH
226
+ ('[C;D3;x2:1](=[O:2])[O:3]-[C;D2][C;D2]=[C;D1]', '[A:1](=[A:2])[A:3]'),
227
+ )
228
+
229
+ _carboxyl_benzyl = ( # [H] or Li/NH3
230
+ ('[C;D3;x2:1](=[O:2])[O:3]-[C;D2]C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1](=[A:2])[A:3]'),
231
+ )
232
+
233
+ _carboxyl_fm = (
234
+ ('[C;x2;M](=[O;M])[O:1][C;D2][C;D3]1C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:C:2-C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:C1:3',
235
+ '[A:1]'),
236
+ )
237
+
238
+ _carboxyl_dmab = (
239
+ ('[C;x2;M](=[O;M])[O:1]-[C;D2]-C:1:[C;D2]:[C;D2]:C(:[C;D2]:[C;D2]:1)-[N;D2]-C([C;D2][C;D3]([C;D1])[C;D1])=C1C(=O)[C;D2]C([C;D1])([C;D1])[C;D2]C1=O',
240
+ '[A:1]'),
241
+ )
242
+
243
+ _amine_methylcarbamate = ( # PrSLi or [OH-]
244
+ # Ar-NH2
245
+ ('[C;a:1][N;D2:2]-C(=O)O[C;D1]', '[A:1][A:2]',
246
+ 'c1ccccc1NC(=O)OC', 'c1ccccc1N', 'c1ccccc1NC(=O)OCC', 'c1cccn1NC(=O)OC'),
247
+ # Alk-NH2
248
+ ('[C;D2,D3,D4;z1;x1:1][N;D2:2]-C(=O)O[C;D1]', '[A:1][A:2]',
249
+ 'CC(C)NC(=O)OC', 'CC(C)N', 'CC(C)NC(=O)OCC', 'CONC(=O)OC', 'C=NC(=O)OC'),
250
+ # Alk-NH-Ar
251
+ ('[C;a:1][N:2]([C;z1;x1:3])-C(=O)O[C;D1]', '[A:1][A:2][A:3]',
252
+ 'c1ccccc1N(C(C)C)C(=O)OC', 'c1ccccc1NC(C)C'),
253
+ # Alk2NH
254
+ ('[C;D2,D3,D4;z1;x1:1][N:2]([C;z1;x1:3])-C(=O)O[C;D1]', '[A:1][A:2][A:3]',
255
+ 'CC(C)N(C(C)C)C(=O)OC', 'CC(C)NC(C)C'),
256
+ )
257
+
258
+ _amine_teoc = ( # [F-]
259
+ # Ar-NH2
260
+ ('[C;a:1][N;D2:2]-C(=O)O[C;D2][C;D2][Si]([C;D1])([C;D1])[C;D1]', '[A:1][A:2]',
261
+ 'c1ccccc1NC(=O)OCC[Si](C)(C)C', 'c1ccccc1N'),
262
+ # Alk-NH2
263
+ ('[C;D2,D3,D4;z1;x1:1][N;D2:2]-C(=O)O[C;D2][C;D2][Si]([C;D1])([C;D1])[C;D1]', '[A:1][A:2]'),
264
+ ('[C;a:1][N:2]([C;z1;x1:3])-C(=O)O[C;D2][C;D2][Si]([C;D1])([C;D1])[C;D1]', '[A:1][A:2][A:3]'), # Alk-NH-Ar
265
+ ('[C;D2,D3,D4;z1;x1:1][N:2]([C;z1;x1:3])-C(=O)O[C;D2][C;D2][Si]([C;D1])([C;D1])[C;D1]', '[A:1][A:2][A:3]'), # Alk2NH
266
+ )
267
+
268
+ _amine_troc = ( # [Zn]
269
+ # Ar-NH2
270
+ ('[C;a:1][N;D2:2]-C(=O)O[C;D2]C(Cl)(Cl)Cl', '[A:1][A:2]',
271
+ 'c1ccccc1NC(=O)OCC(Cl)(Cl)Cl', 'c1ccccc1N', 'c1ccccc1NC(=O)OC(C)C(Cl)(Cl)Cl'),
272
+ # Alk-NH2
273
+ ('[C;D2,D3,D4;z1;x1:1][N;D2:2]-C(=O)O[C;D2]C(Cl)(Cl)Cl', '[A:1][A:2]'),
274
+ # Alk-NH-Ar
275
+ ('[C;a:1][N:2]([C;z1;x1:3])-C(=O)O[C;D2]C(Cl)(Cl)Cl', '[A:1][A:2][A:3]'),
276
+ # Alk2NH
277
+ ('[C;D2,D3,D4;z1;x1:1][N:2]([C;z1;x1:3])-C(=O)O[C;D2]C(Cl)(Cl)Cl', '[A:1][A:2][A:3]'),
278
+ )
279
+
280
+ _amine_alloc = ( # [Pd]
281
+ # Ar-NH2
282
+ ('[C;a:1][N;D2:2]-C(=O)O[C;D2][C;D2]=[C;D1]', '[A:1][A:2]',
283
+ 'c1ccccc1NC(=O)OCC=C', 'c1ccccc1N', 'c1ccccc1NC(=O)OCC=CC'),
284
+ # Alk-NH2
285
+ ('[C;D2,D3,D4;z1;x1:1][N;D2:2]-C(=O)O[C;D2][C;D2]=[C;D1]', '[A:1][A:2]'),
286
+ # Alk-NH-Ar
287
+ ('[C;a:1][N:2]([C;z1;x1:3])-C(=O)O[C;D2][C;D2]=[C;D1]', '[A:1][A:2][A:3]'),
288
+ # Alk2NH
289
+ ('[C;D2,D3,D4;z1;x1:1][N:2]([C;z1;x1:3])-C(=O)O[C;D2][C;D2]=[C;D1]', '[A:1][A:2][A:3]'),
290
+ )
291
+
292
+ _amine_cbz = ( # [Pd] or Na/NH3
293
+ # Ar-NH2
294
+ ('[C;a:1][N;D2:2]-C(=O)O[C;D2]C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1][A:2]',
295
+ 'c1ccccc1NC(=O)OCc2ccccc2', 'c1ccccc1N', 'c1ccccc1NC(=O)OC(C)c2ccccc2'),
296
+ # Alk-NH2
297
+ ('[C;D2,D3,D4;z1;x1:1][N;D2:2]-C(=O)O[C;D2]C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1][A:2]'),
298
+ # Alk-NH-Ar
299
+ ('[C;a:1][N:2]([C;z1;x1:3])-C(=O)O[C;D2]C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1][A:2][A:3]'),
300
+ # Alk2NH
301
+ ('[C;D2,D3,D4;z1;x1:1][N:2]([C;z1;x1:3])-C(=O)O[C;D2]C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1][A:2][A:3]'),
302
+ )
303
+
304
+ _amine_chloro_cbz = (
305
+ # Ar-NH2
306
+ ('[C;a;M][N;D2:1]-C(=O)O[C;D2]C:1:C([Cl;D1]):[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1]',
307
+ 'Clc1ccccc1COC(=O)Nc1ccccc1', 'c1ccccc1N', 'c1ccccc1NC(=O)OC(C)c2ccccc2'),
308
+ # Alk-NH2
309
+ ('[C;D2,D3,D4;z1;x1;M][N;D2:1]-C(=O)O[C;D2]C:1:C([Cl;D1]):[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1]'),
310
+ # Alk-NH-Ar
311
+ ('[C;a;M][N:1]([C;z1;x1;M])-C(=O)O[C;D2]C:1:C([Cl;D1]):[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1]'),
312
+ # Alk2NH
313
+ ('[C;D2,D3,D4;z1;x1;M][N:1]([C;z1;x1;M])-C(=O)O[C;D2]C:1:C([Cl;D1]):[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1]'),
314
+ )
315
+
316
+ _amine_nosyl = ( # NS. With SH-CH2-CH2-OH
317
+ # Ar-NH2
318
+ ('[C;a:1][N;D2:2]-S(=O)(=O)C:1:C([N+](=O)[O-]):[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1][A:2]',
319
+ '[O-][N+](=O)c1ccccc1S(=O)(=O)Nc1ccccc1', 'c1ccccc1N'),
320
+ # Alk-NH2
321
+ ('[C;D2,D3,D4;z1;x1:1][N;D2:2]-S(=O)(=O)C:1:C([N+](=O)[O-]):[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1][A:2]'),
322
+ # Alk-NH-Ar
323
+ ('[C;a:1][N:2]([C;z1;x1:3])-S(=O)(=O)C:1:C([N+](=O)[O-]):[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1][A:2][A:3]'),
324
+ # Alk2NH
325
+ ('[C;D2,D3,D4;z1;x1:1][N:2]([C;z1;x1:3])-S(=O)(=O)C:1:C([N+](=O)[O-]):[C;D2]:[C;D2]:[C;D2]:[C;D2]:1',
326
+ '[A:1][A:2][A:3]'),
327
+ )
328
+
329
+ _amine_boc = (
330
+ # Ar-NH2
331
+ ('[C;a;M][N;D2;x0;z1:1]-[C;x3;z2](=O)[O;x0;z1][C;D4;x1]([C;D1])([C;D1])[C;D1]', '[A:1]',
332
+ 'c1ccccc1NC(=O)OC(C)(C)C', 'c1ccccc1N'),
333
+ # Alk-NH2
334
+ ('[C;D2,D3,D4;z1;x1;M][N;D2;x0;z1:1]-[C;x3;z2](=O)[O;x0;z1][C;D4;x1]([C;D1])([C;D1])[C;D1]', '[A:1]'),
335
+ # Alk-NH-Ar
336
+ ('[C;a;M][N;D3;x0;z1:1]([C;z1;x1;M])-[C;x3;z2](=O)[O;x0;z1][C;D4;x1]([C;D1])([C;D1])[C;D1]', '[A:1]'),
337
+ # Alk2NH
338
+ ('[C;D2,D3,D4;z1;x1;M][N;D3;x0;z1:1]([C;z1;x1;M])-[C;x3;z2](=O)[O;x0;z1][C;D4;x1]([C;D1])([C;D1])[C;D1]', '[A:1]'),
339
+ # Alk[NH]-O-Alk
340
+ ('[C;D2,D3,D4;z1;x1;M][N;D3;x1;z1:1]([O;D2;x1;z1;M][C;z1;x1;M])-[C;x3;z2](=O)[O;x0;z1][C;D4;x1]([C;D1])([C;D1])[C;D1]', '[A:1]'),
341
+ # Alk-[NH]-COC
342
+ ('[C;D2,D3,D4;z1;x1;r5;M]1-;@[N;D3;x0;z1:1](-;@[C;z1;x2;M]-;@[O,S;D2;x0;z1;M][C;z1;x1;M]1)-[C;x3;z2](=O)[O;x0;z1][C;D4;x1]([C;D1])([C;D1])[C;D1]', '[A:1]'),
343
+ ('[C;D2,D3,D4;z1;x1;r6,r7,r8,r9;M]-;@[N;D3;x0;z1:1](-;@[C;z1;x2;M]-;@[O,S;D2;x0;z1;M][C;z1;x1;M])-[C;x3;z2](=O)[O;x0;z1][C;D4;x1]([C;D1])([C;D1])[C;D1]', '[A:1]'),
344
+ # amino-pyrrolidine
345
+ ('[C;D3;z1;x2;r5;M](-;@[N;M])[N;D2;x0;z1:1]-[C;x3;z2](=O)[O;x0;z1][C;D4;x1]([C;D1])([C;D1])[C;D1]', '[A:1]',
346
+ 'CC(C)(C)OC(=O)NC1CCCN1', 'NC1CCCN1'),
347
+ )
348
+
349
+ _amine_tfa = (
350
+ # Ar-NH2
351
+ ('[C;a:1][N;D2:2]-C(=O)C(F)(F)F', '[A:1][A:2]'),
352
+ # Alk-NH2
353
+ ('[C;D2,D3,D4;z1;x1:1][N;D2:2]-C(=O)C(F)(F)F', '[A:1][A:2]'),
354
+ # Alk-NH-Ar
355
+ ('[C;a:1][N:2]([C;z1;x1:3])-C(=O)C(F)(F)F', '[A:1][A:2][A:3]'),
356
+ # Alk2NH
357
+ ('[C;D2,D3,D4;z1;x1:1][N:2]([C;z1;x1:3])-C(=O)C(F)(F)F', '[A:1][A:2][A:3]'),
358
+ )
359
+
360
+ _amine_fmoc = (
361
+ # Ar-NH2
362
+ ('[C;a:1][N;D2:2]-C(=O)O[C;D2][C;D3]1C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:C:2-C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:C1:3',
363
+ '[A:1][A:2]',
364
+ 'O=C(Nc1ccccc1)OCC1c2ccccc2-c2ccccc12', 'c1ccccc1N'),
365
+ # Alk-NH2
366
+ ('[C;D2,D3,D4;z1;x1:1][N;D2:2]-C(=O)O[C;D2][C;D3]1C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:C:2-C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:C1:3', # noqa
367
+ '[A:1][A:2]'),
368
+ # Alk-NH-Ar
369
+ ('[C;a:1][N:2]([C;z1;x1:3])-C(=O)O[C;D2][C;D3]1C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:C:2-C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:C1:3', # noqa
370
+ '[A:1][A:2][A:3]'),
371
+ # Alk2NH
372
+ ('[C;D2,D3,D4;z1;x1:1][N:2]([C;z1;x1:3])-C(=O)O[C;D2][C;D3]1C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:C:2-C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:C1:3', # noqa
373
+ '[A:1][A:2][A:3]'),
374
+ )
375
+
376
+ _amine_pbf_pmc_mtr = (
377
+ # Ar-NH2
378
+ ('[C;a;M][N;D2:1]-S(=O)(=O)-C:1:C([C;D1]):C([C;D1]):C(O[C;x1;z1]):C:C([C;D1]):1',
379
+ '[A:1]'),
380
+ # Alk-NH2
381
+ ('[C;D2,D3,D4;z1;x1;M][N;D2:1]-S(=O)(=O)-C:1:C([C;D1]):C([C;D1]):C(O[C;x1;z1]):C:C([C;D1]):1',
382
+ '[A:1]'),
383
+ # Alk-NH-Ar
384
+ ('[C;a;M][N:1]([C;z1;x1;M])-S(=O)(=O)-C:1:C([C;D1]):C([C;D1]):C(O[C;x1;z1]):C:C([C;D1]):1',
385
+ '[A:1]'),
386
+ # Alk2NH
387
+ ('[C;D2,D3,D4;z1;x1;M][N:1]([C;z1;x1;M])-S(=O)(=O)-C:1:C([C;D1]):C([C;D1]):C(O[C;x1;z1]):C:C([C;D1]):1',
388
+ '[A:1]'),
389
+ # Guanidine
390
+ ('[N;M]=[C;M]([N;M])[N;D2:1]-S(=O)(=O)-C:1:C([C;D1]):C([C;D1]):C(O[C;x1;z1]):C:C([C;D1]):1',
391
+ '[A:1]'),
392
+ ('[N;M][C;M]([N;M])=[N:1]-S(=O)(=O)-C:1:C([C;D1]):C([C;D1]):C(O[C;x1;z1]):C:C([C;D1]):1',
393
+ '[A:1]'),
394
+ )
395
+
396
+ _amine_dde = (
397
+ # Ar-NH2
398
+ ('[C;a;M][N;D2:1]-C([C;D1])=C1C(=O)[C;D2]C([C;D1])([C;D1])[C;D2]C1=O', '[A:1]'),
399
+ # Alk-NH2
400
+ ('[C;D2,D3,D4;z1;x1;M][N;D2:1]-C([C;D1])=C1C(=O)[C;D2]C([C;D1])([C;D1])[C;D2]C1=O', '[A:1]'),
401
+ # Alk-NH-Ar
402
+ ('[C;a;M][N:1]([C;z1;x1;M])-C([C;D1])=C1C(=O)[C;D2]C([C;D1])([C;D1])[C;D2]C1=O', '[A:1]'),
403
+ # Alk2NH
404
+ ('[C;D2,D3,D4;z1;x1;M][N:1]([C;z1;x1;M])-C([C;D1])=C1C(=O)[C;D2]C([C;D1])([C;D1])[C;D2]C1=O', '[A:1]'),
405
+ )
406
+
407
+ _amine_ivdde = (
408
+ # Ar-NH2
409
+ ('[C;a;M][N;D2:1]-C([C;D2][C;D3]([C;D1])[C;D1])=C1C(=O)[C;D2]C([C;D1])([C;D1])[C;D2]C1=O', '[A:1]'),
410
+ # Alk-NH2
411
+ ('[C;D2,D3,D4;z1;x1;M][N;D2:1]-C([C;D2][C;D3]([C;D1])[C;D1])=C1C(=O)[C;D2]C([C;D1])([C;D1])[C;D2]C1=O', '[A:1]'),
412
+ # Alk-NH-Ar
413
+ ('[C;a;M][N:1]([C;z1;x1;M])-C([C;D2][C;D3]([C;D1])[C;D1])=C1C(=O)[C;D2]C([C;D1])([C;D1])[C;D2]C1=O', '[A:1]'),
414
+ # Alk2NH
415
+ ('[C;D2,D3,D4;z1;x1;M][N:1]([C;z1;x1;M])-C([C;D2][C;D3]([C;D1])[C;D1])=C1C(=O)[C;D2]C([C;D1])([C;D1])[C;D2]C1=O',
416
+ '[A:1]'),
417
+ )
418
+
419
+ _amine_mtt = (
420
+ # Ar-NH2
421
+ ('[C;a;M][N;D2:1]-C(C:1:[C;D2]:[C;D2]:C([C;D1]):[C;D2]:[C;D2]:1)(C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2)C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:3',
422
+ '[A:1]'),
423
+ # Alk-NH2
424
+ ('[C;D2,D3,D4;z1;x1;M][N;D2:1]-C(C:1:[C;D2]:[C;D2]:C([C;D1]):[C;D2]:[C;D2]:1)(C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2)C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:3',
425
+ '[A:1]'),
426
+ # Alk-NH-Ar
427
+ ('[C;a;M][N:1]([C;z1;x1;M])-C(C:1:[C;D2]:[C;D2]:C([C;D1]):[C;D2]:[C;D2]:1)(C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2)C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:3',
428
+ '[A:1]'),
429
+ # Alk2NH
430
+ ('[C;D2,D3,D4;z1;x1;M][N:1]([C;z1;x1;M])-C(C:1:[C;D2]:[C;D2]:C([C;D1]):[C;D2]:[C;D2]:1)(C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2)C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:3',
431
+ '[A:1]'),
432
+ )
433
+
434
+ _amine_bhoc = (
435
+ # Ar-NH2
436
+ ('[C;a;M][N;D2:1]-C(=O)O[C;D3](C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1)C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2',
437
+ '[A:1]'),
438
+ # Alk-NH2
439
+ ('[C;D2,D3,D4;z1;x1;M][N;D2:1]-C(=O)O[C;D3](C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1)C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2',
440
+ '[A:1]'),
441
+ # Alk-NH-Ar
442
+ ('[C;a;M][N:1]([C;z1;x1;M])-C(=O)O[C;D3](C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1)C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2',
443
+ '[A:1]'),
444
+ # Alk2NH
445
+ ('[C;D2,D3,D4;z1;x1;M][N:1]([C;z1;x1;M])-C(=O)O[C;D3](C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1)C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2',
446
+ '[A:1]'),
447
+ # Guanidine
448
+ ('[N;M]=[C;M]([N;M])[N;D2:1]-C(=O)O[C;D3](C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1)C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2',
449
+ '[A:1]'),
450
+ ('[N;M][C;M]([N;M])=[N:1]-C(=O)O[C;D3](C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1)C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2',
451
+ '[A:1]'),
452
+ )
453
+
454
+ _amide_tritil = (
455
+ ('[C;D3;x2;M](=[O;M])[N;D2:1]-C(C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1)(C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2)C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:3', # noqa
456
+ '[A:1]'),
457
+ )
458
+
459
+ _amide_boc = (
460
+ ('[N;D2,D3;x0;z1:1]([C;D3;x2;z2;M]=[O;M])-[C;x3;z2](=O)[O;x0;z1][C;D4;x1]([C;D1])([C;D1])[C;D1]', '[A:1]',
461
+ 'CC(=O)NC(=O)OC(C)(C)C', 'CC(N)=O'),
462
+ )
463
+
464
+ _thiol_tritil = (
465
+ ('[C;D2,D3,D4;z1;x1;M][S;D2:1]-C(C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1)(C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2)C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:3', # noqa
466
+ '[A:1]'),
467
+ )
468
+
469
+ _thiol_mmt = (
470
+ ('[C;D2,D3,D4;z1;x1;M][S;D2:1]-C(C:1:[C;D2]:[C;D2]:C(-O[C;D1]):[C;D2]:[C;D2]:1)(C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2)C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:3', # noqa
471
+ '[A:1]'),
472
+ )
473
+
474
+ _thiol_benzyl = (
475
+ ('[C;D2,D3,D4;z1;x1;M][S;D2:1]-[C;D2]C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1]'),
476
+ )
477
+
478
+ _thiol_tbu = (
479
+ ('[C;D2,D3,D4;z1;x1;M][S;D2:1]-C([C;D1])([C;D1])[C;D1]', '[A:1]'),
480
+ )
481
+
482
+ _thiol_strimethoxyphenyl = (
483
+ ('[C;D2,D3,D4;z1;x1;M][S;D2:1]-[S;D2]-C:1:C(O[C;D1]):[C;D2]:C(O[C;D1]):[C;D2]:C:1-O[C;D1]', '[A:1]'),
484
+ )
485
+
486
+ _thiol_stbu = (
487
+ ('[C;D2,D3,D4;z1;x1;M][S;D2:1]-[S;D2]-C([C;D1])([C;D1])[C;D1]', '[A:1]'),
488
+ )
489
+
490
+ _thiol_amide_dimethoxybenzyl = ( # N1CCSC1
491
+ ('[S;D2:1]1[C;x1;z1;M][C;x1;z1;M][N:2]([C;M]=[O;M])-[C;D3]1-C:2:C(O[C;D1]):[C;D2]:C(O[C;D1]):[C;D2]:[C;D2]:2',
492
+ '[A:1].[A:2]'),
493
+ )
494
+
495
+ _pyrrole_boc = (
496
+ ('[N;a;r5:1]-C(=O)OC([C;D1])([C;D1])[C;D1]', '[A:1]'),
497
+ )
498
+
499
+ _pyrrole_chloro_tritil = (
500
+ ('[N;a;r5:1]-C(C:1:C([Cl;D1]):[C;D2]:[C;D2]:[C;D2]:[C;D2]:1)(C:2:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:2)C:3:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:3',
501
+ '[A:1]'),
502
+ )
503
+
504
+ _phenol_tbu = (
505
+ ('[C;a;M][O:1]-C([C;D1])([C;D1])[C;D1]', '[A:1]'),
506
+ )
507
+
508
+ _phenol_hydroxymethyl_acetone = (
509
+ ('[C;M]1:[C;M][O:1]C([C;D1])([C;D1])[O:2][C;z1;x1;M]1', '[A:1].[A:2]'),
510
+ )
511
+
512
+ _phosphate_benzyl = (
513
+ ('[O;M][P;M](=[O;M])([O;M])[O:1]-[C;D2]C:1:[C;D2]:[C;D2]:[C;D2]:[C;D2]:[C;D2]:1', '[A:1]'),
514
+ )
515
+
516
+ #################
517
+ # Magic Factory #
518
+ #################
519
+
520
+ _groups = [k[1:] for k, v in globals().items() if k.startswith('_') and isinstance(v, tuple) and v]
521
+ __all__ = ['apply_all'] + _groups
522
+ _cache = {}
523
+
524
+
525
+ def _prepare_reactor(rules, name):
526
+ rxn = [Transformer(smarts(r), smarts(p)) for r, p, *_ in rules]
527
+
528
+ def w(molecule: MoleculeContainer, /) -> MoleculeContainer:
529
+ """
530
+ Remove protective groups from the given molecule if applicable.
531
+ """
532
+ for r in rxn:
533
+ while True:
534
+ try:
535
+ molecule = next(r(molecule))
536
+ except StopIteration:
537
+ break
538
+ return molecule
539
+
540
+ w.__module__ = __name__
541
+ w.__qualname__ = w.__name__ = name
542
+ return w
543
+
544
+
545
+ def apply_all(molecule: MoleculeContainer, /) -> MoleculeContainer:
546
+ """
547
+ Remove all found protective groups from the given molecule.
548
+ """
549
+ for name in _groups:
550
+ molecule = __getattr__(name)(molecule)
551
+ return molecule
552
+
553
+
554
+ def __getattr__(name):
555
+ try:
556
+ return _cache[name]
557
+ except KeyError:
558
+ if name in _groups:
559
+ _cache[name] = t = _prepare_reactor(globals()[f'_{name}'], name)
560
+ return t
561
+ raise AttributeError
562
+
563
+
564
+ def __dir__():
565
+ return __all__
@@ -0,0 +1,128 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright 2024 Ramil Nugmanov <nougmanoff@protonmail.com>
4
+ # This file is part of chython.
5
+ #
6
+ # chython is free software; you can redistribute it and/or modify
7
+ # it under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation; either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public License
17
+ # along with this program; if not, see <https://www.gnu.org/licenses/>.
18
+ #
19
+ from ..files import smarts
20
+
21
+
22
+ _groups = {
23
+ 'Alkene': '[C;z2;x0]=[C;x0;z2]',
24
+ 'Alkene hetero': '[C;z2;x1,x2]=[C;z2]',
25
+ 'Alkene terminal': '[C;z2;x0;D1]=[C;x0;z2]',
26
+ 'Alkene hetero terminal': '[C;z2;x0;D1]=[C;x1,x2;z2]',
27
+ 'Alkyne': '[C;z3;x0]#[C;x0]',
28
+ 'Alkyne hetero': '[C;z3;x1]#[C]',
29
+ 'Alkyne terminal': '[C;z3;x0;D1]#[C;x0]',
30
+ 'Alkyne hetero terminal': '[C;z3;x0;D1]#[C;x1]',
31
+
32
+ 'Alkyl Halide': '[F,Cl,Br,I;D1][C;x1;z1]',
33
+ 'Cyclopropyl Halide': '[F,Cl,Br,I;D1][C;x1;z1;r3]',
34
+
35
+ 'Aryl Halide': '[F,Cl,Br,I;D1]-[C;a]',
36
+ 'Aryl Fluoride': '[F;D1]-[C;a]',
37
+ 'Aryl Chloride': '[Cl;D1]-[C;a]',
38
+ 'Aryl Bromide': '[Br;D1]-[C;a]',
39
+ 'Aryl Iodide': '[I;D1]-[C;a]',
40
+
41
+ 'Aryl Halide SNAr alpha': '[F,Cl,Br,I;D1][C;a]:N',
42
+ 'Aryl Halide SNAr gamma': '[F,Cl,Br,I;D1][C;a]:C:C:N',
43
+
44
+ 'Aryl Fluoride SNAr alpha': '[F;D1][C;a]:N',
45
+ 'Aryl Fluoride SNAr gamma': '[F;D1][C;a]:C:C:N',
46
+ 'Aryl Chloride SNAr alpha': '[Cl;D1][C;a]:N',
47
+ 'Aryl Chloride SNAr gamma': '[Cl;D1][C;a]:C:C:N',
48
+ 'Aryl Bromide SNAr alpha': '[Br;D1][C;a]:N',
49
+ 'Aryl Bromide SNAr gamma': '[Br;D1][C;a]:C:C:N',
50
+ 'Aryl Iodide SNAr alpha': '[I;D1][C;a]:N',
51
+ 'Aryl Iodide SNAr gamma': '[I;D1][C;a]:C:C:N',
52
+
53
+ 'Alcohol aliphatic': '[O;D1;x0;z1][C;x1;z1]',
54
+ 'Alcohol primary or secondary aliphatic': '[O;D1;x0;z1][C;D1,D2,D3;x1;z1]',
55
+ 'Alcohol tertiary aliphatic': '[O;D1;x0;z1][C;D4;x1;z1]',
56
+
57
+ 'Alcohol aromatic': '[O;D1;x0;z1][C;a]',
58
+
59
+ 'Aldehyde': '[O;z2;x0]=[C;D1,D2;x1;z2]',
60
+ 'Aldehyde aliphatic': '[O;z2;x0]=[C;D2;x1;z2][C;z1]',
61
+ 'Aldehyde aromatic': '[O;z2;x0]=[C;D2;x1;z2][C;a]',
62
+ 'Ketone': '[O;z2;x0]=[C;D3;x1;z2]',
63
+
64
+ 'Carboxylic Acid': '[O;D1;z1;x0][C;D3;x2;z2]=O',
65
+ 'Carboxylic Acid aliphatic': '[O;D1;z1;x0][C;D3;x2;z2](=O)[C;z1]',
66
+ 'Carboxylic Acid aromatic': '[O;D1;z1;x0][C;D3;x2;z2](=O)[C;a]',
67
+
68
+ 'Carboxylic Acid Ester': '[O;z2;x0]=[C;D3;x2;z2][O;D2;x0]',
69
+ 'Carboxylic Acid Halide': '[F,Cl,Br,I;D1][C;D3;x2;z2]=O',
70
+
71
+ 'Amine primary': '[N;D1;x0;z1][C;z1,z4;x1]',
72
+ 'Amine primary aliphatic': '[N;D1;x0;z1][C;z1;x1]',
73
+ 'Amine primary aromatic': '[N;D1;x0;z1][C;a]',
74
+ 'Amine secondary': '[N;D2;x0;z1]([C;z1,z4;x1])[C;z1,z4;x1]',
75
+ 'Amine secondary aliphatic': '[N;D2;x0;z1]([C;z1;x1])[C;z1;x1]',
76
+ 'Amine secondary aromatic': '[N;D2;x0;z1]([C;a])[C;z1,z4;x1]',
77
+ 'Amine tertiary': '[N;D3;x0;z1]([C;z1,z4;x1])([C;z1,z4;x1])[C;z1,z4;x1]',
78
+ 'Amine cyclic': '[N;D2;x0;z1;r4,r5,r6,r7,r8]([C;z1;x1])[C;z1;x1]',
79
+
80
+ 'Alpha-aminoacid': '[N;D1;x0;z1][C;z1;x1][C;D3;z2;x2](=O)[O;D1]',
81
+ 'Beta-aminoacid': '[N;D1;x0;z1][C;z1;x1][C;z1][C;D3;z2;x2](=O)[O;D1]',
82
+ 'Gamma-aminoacid': '[N;D1;x0;z1][C;z1;x1][C;z1][C;z1][C;D3;z2;x2](=O)[O;D1]',
83
+
84
+ 'Alpha-aminoacid N-protected': '[N;D2;x0;z1]([C;z1;x1][C;D3;z2;x2](=O)[O;D1])[C;D3;z2;x3](=O)[O;D2;x0]C',
85
+ 'Beta-aminoacid N-protected': '[N;D2;x0;z1]([C;z1;x1][C;z1][C;D3;z2;x2](=O)[O;D1])[C;D3;z2;x3](=O)[O;D2;x0]C',
86
+ 'Gamma-aminoacid N-protected': '[N;D2;x0;z1]([C;z1;x1][C;z1][C;z1][C;D3;z2;x2](=O)[O;D1])[C;D3;z2;x3](=O)[O;D2;x0]C',
87
+
88
+ 'Alpha-aminoacid O-protected': '[N;D1;x0;z1][C;z1;x1][C;D3;z2;x2](=O)[O;D2;x0][C;z1;x1]',
89
+ 'Beta-aminoacid O-protected': '[N;D1;x0;z1][C;z1;x1][C;z1][C;D3;z2;x2](=O)[O;D2;x0][C;z1;x1]',
90
+ 'Gamma-aminoacid O-protected': '[N;D1;x0;z1][C;z1;x1][C;z1][C;z1][C;D3;z2;x2](=O)[O;D2;x0][C;z1;x1]',
91
+
92
+ 'Aryl Sulfone': '[S;D4;z3;x2](=O)(=O)(-[C;a])-[C;x1]',
93
+ 'Azide': '[N-;D1;x1;z2]=[N+;D2;x2;z3]=[N;D2;x1;z2]',
94
+
95
+ 'Boronic Acid': '[B;D3;x2;z1]([O;D1])[O;D1]',
96
+ 'Boronic Acid Ester': '[B;D3;x2;z1]([O;D2;x1])([O;D2;x1])-;!@C',
97
+ 'Boronic Acid Ester aliphatic': '[B;D3;x2;z1]([O;D2;x1])([O;D2;x1])-;!@[C;x1;z1]',
98
+ 'Boronic Acid Ester aromatic': '[B;D3;x2;z1]([O;D2;x1])([O;D2;x1])-;!@[C;a]',
99
+ 'Trifluoroborate': '[B;D4;x3;z1;-](F)(F)(F)',
100
+
101
+ 'Thiol aliphatic': '[S;D1;x0;z1][C;x1;z1]',
102
+ 'Thiol aromatic': '[S;D1;x0;z1][C;a]',
103
+
104
+ 'Hydrazine aromatic': '[N;D1;x1;z1][N;D2;x1;z1][C;a]',
105
+ 'Hydrazine aliphatic': '[N;D1;x1;z1][N;D2;x1;z1][C;x1;z1]',
106
+
107
+ 'Isocyanate': '[O;D1;z2;x0]=[C;D2;x2;z3]=[N;D2;x0;z2]',
108
+ 'Isothiocyanate': '[S;D1;z2;x0]=[C;D2;x2;z3]=[N;D2;x0;z2]',
109
+ 'Nitrile': '[N;D1;z3;x0]#[C;D2;x1]',
110
+ 'Isonitrile': '[C-;D1;x1;z3]#[N+;D2;x0]',
111
+ 'Sulfonyl Halide': '[S;D4;z3;x3]([F,Cl,Br,I;D1])(=O)=O',
112
+ 'Lactam': '[O;D1;x0;z2]=[C;D3;x2](-;@[N;x0;z1]-;@[C;x1;z1])[C;x0;z1]',
113
+ 'Cyclic Anhydride': '[O;D1;x0;z2]=[C;D3;x2;z2;r4,r5,r6,r7,r8][O;D2;x0][C;D3;x2;z2]=O'
114
+ }
115
+
116
+ _smarts = {n.lower().replace(' ', '_'): smarts(s) for n, s in _groups.items()}
117
+ __all__ = list(_smarts)
118
+
119
+
120
+ def __getattr__(name):
121
+ try:
122
+ return _smarts[name]
123
+ except KeyError:
124
+ raise AttributeError
125
+
126
+
127
+ def __dir__():
128
+ return __all__