-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from matteoferla/dev-teo
🚚 merging branch
- Loading branch information
Showing
263 changed files
with
16,162 additions
and
4,749 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
These are snippets that need to go somewhere | ||
# 1 | ||
|
||
To make Victor carp at any exception, do | ||
|
||
Victor.error_to_catch = () | ||
|
||
This is because `try`/`except` can accept multiple error classes as a tuple. | ||
|
||
# 2 | ||
|
||
`ConnectionError` is meant for comms connection errors, but here it is raised as bad bonding. | ||
|
||
# 3 | ||
|
||
Show the steps | ||
|
||
from IPython.display import display | ||
|
||
monster = Monster([fore, aft]).merge() | ||
for m in monster.modifications: | ||
display(m) | ||
Show multiple RDKit mols in nglview | ||
|
||
import nglview as nv | ||
from io import StringIO | ||
|
||
def show_mols(*mols: Chem.Mol) -> nv.NGLWidget: | ||
view = nv.NGLWidget() | ||
for mol in mols: | ||
fh = StringIO(Chem.MolToPDBBlock(mol)) | ||
view.add_component(fh, ext='pdb') | ||
return view | ||
|
||
# X | ||
|
||
One issue is that the ring mergers are not transitive. | ||
Hit order results in different cases: | ||
|
||
ortho = Chem.MolFromSmiles('Cc1cc(O)ccc1') | ||
meta = Chem.MolFromSmiles('Cc1ccc(O)cc1') | ||
AllChem.EmbedMolecule(ortho) | ||
AllChem.EmbedMolecule(meta) | ||
Chem.rdMolAlign.AlignMol(prbMol=ortho, | ||
refMol=meta, | ||
atomMap=[(0,0), (1,1)], | ||
weights=[1,1], | ||
) | ||
show_mols(ortho, meta) | ||
|
||
These two cresol rings are perpendicular. The merger produces the same compound, methylcatecol | ||
but one has a more distorted conformation. | ||
|
||
Monster([ortho, meta]).merge().positioned_mol # decent | ||
Monster([meta, ortho]).merge().positioned_mol # indecent | ||
|
||
What are the implications for this? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
## Monster entrypoints | ||
|
||
Previously merging in `Monster` was overly complicated and an add-on, now it is cleaner as the initialisation of | ||
the object does not do a placement. To do that one has to do: | ||
|
||
monster = Monster(hits) | ||
monster.place(mol) | ||
monster.positioned_mol | ||
|
||
or `place_smiles` for a SMILES. | ||
|
||
While to do a merger | ||
|
||
monster = Monster(hits) | ||
monster.combine() | ||
monster.positioned_mol | ||
|
||
Additionally, the attribute `modifications` was added/expanded, so that intermediate steps are stored | ||
for potential inspection. | ||
It is a dictionary, but since 3.6 dict is ordered and `.keep_copy(mol, label)` prevents over-writes. | ||
This includes `scaffold` (the template) and `chimera` (the template with the atom symbols adapted), | ||
which are no longer attributes. | ||
|
||
Equally viable alternatives are stored in a list | ||
|
||
monster.mol_options | ||
|
||
`combine` still calls `simply_merge_hits`, which is used by placement too and merges by fragmentation | ||
—unlike atom-ring absorption events. The fact that two different approaches are present is just historical. | ||
|
||
If one wanted to merge two or more hits, independently of those in `.hits` attribute and without ring collapsing | ||
and rectification etc. | ||
`simply_merge_hits` is still the method to use: | ||
|
||
monster = Monster([]) | ||
monster.simply_merge_hits([molA, molB]) | ||
|
||
The `place` method accepts the argument `merging_mode`, by default it is "permissive_none", | ||
which calls `.no_blending(broad=True)`, | ||
but "off" (nothing), | ||
"full" (`.full_blending()`), | ||
"partial" (`.partial_blending()`) | ||
and "none" (`.no_blending()`) | ||
are accepted. | ||
|
||
## Names | ||
The names "merge" and "place" were ultra-confusingly ambiguous when it comes to the other methods, especially those of "place". | ||
|
||
* Now all the cases where hits are partially combined for placement purposes are called "blending" | ||
The placement of the (distorted) 3D final monster compound Victor is called "plonk". | ||
|
||
* place and position are used synonymously | ||
* combine and merge are used synonymously | ||
|
||
|
||
## Future | ||
Victor however still has the merger as a side route. | ||
|
||
## Overlapping rings | ||
|
||
There was a bug in the code for `Monster` that meant that if two rings from different origins that were not bonded | ||
—i.e. without side atoms that were absorbed they were not assessed for merging. This has been corrected. | ||
|
||
Namely, what happens to rings is controlled in `expand_ring` method, which calls `_add_novel_bonding`, where "novel" | ||
means that does not share the same "origin" (original molecule). | ||
The latter method calls in turn `_get_novel_ringcore_pairs`, which now get ring marking atoms that are close or bonded. | ||
Closeness is determined by ring atoms (not ring core markers) within 1.5 Å cutoff (viz. `_get_close_nonorigin_ringcores`) | ||
|
||
The test case was the merger of a phenylacetic acid and phenylacetamide which overlap in two ring carbons and a terminal oxygen, resulting | ||
in a phenylene-like ring (where one ring is an oxazine). See tests. | ||
|
||
![phenylene](../images/phenylene.png) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
## Covalent | ||
|
||
Covalent forms of a molecule are marked within the `Chem.Mol` instances in fragmenstein with a "dummy atom". | ||
This is element symbol `*` within RDKit and smiles, but `R` in a mol file and PDB file. | ||
|
||
This is essential for the params file (topology file for the ligand). | ||
|
||
Consequently, hits are best extracted with `Victor.extract_mols` or `Victor.extract_mol`. | ||
Fragalysis does not do this, so the hits from there will be treated as regular compounds. | ||
|
||
## Monster | ||
|
||
A molecule with a single atom is passed to `attachment` argument of `Monster`, | ||
then the covalent linker if absent in the hits is anchored to that atom. | ||
If you know a ligand that is covalent `Victor.find_attachment` can be used to extract the attachment atom. | ||
|
||
## Warheads | ||
|
||
Victor has a cysteine reactive warheads operations | ||
In the class attribute `.warhead_definitions` are stored conversions and atom names | ||
(cf. MProVictor for an example). | ||
|
||
**acrylamide** `C(=O)C=C` => `C(=O)CC*` | ||
**chloroacetamide** `C(=O)C[Cl]` => `C(=O)C*` | ||
**nitrile** `C(#N)` => `C(=N)*` | ||
**vinylsulfonamide** `S(=O)(=O)C=C` => `S(=O)(=O)CC*` | ||
**bromoalkyne** `C#C[Br]` => `C(=C)*` | ||
|
||
Additionally, `.possible_definitions` contains two (or more) that may be added experimentally (don't currently work). | ||
|
||
**aurothiol** `S[Au]P(CC)(CC)CC` => `S[Au]*` | ||
**aldehyde** `[C:H1]=O` => `C(O)*` | ||
|
||
There is a quick way to get a warhead definition too | ||
|
||
Victor.get_warhead_definition(warhead_name) | ||
|
||
In terms of Rosetta constraints (restraints), these can be added with | ||
|
||
Victor.add_constraint_to_warhead(name=constrain_name, constraint=constraint) | ||
|
||
For example: | ||
|
||
* _chloroacetamide_: `AtomPair H 145A OY 1B HARMONIC 2.1 0.2` | ||
* _nitrile_: `AtomPair H 145A NX 1B HARMONIC 2.1 0.2` | ||
* _acrylamide_: `AtomPair H 143A OZ 1B HARMONIC 2.1 0.2` | ||
* _vinylsulfonamide_: `AtomPair H 143A OZ1 1B HARMONIC 2.1 0.2` | ||
|
||
Currently, only cysteine details are known to `Victor`. Cf. `.covalent_definitions`. | ||
|
||
To convert a react_ive_ SMILES to a dummy-atom–marked react_ed_ SMILES: | ||
|
||
Victor.make_all_warhead_combinations(smiles, warhead_name) | ||
|
||
### Untested backdoor | ||
The default dummy atom can be overridden with `Monster.dummy:Chem.Mol` and `Fragmenstein.dummy_symbol:str`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.