Comments (2)
You are welcome!
If you would like to make replacements at a particular position there are two options.
Option 1. Remove a dummy atom, store the id of the attached atom (idx
) and pass it as an argument replace_ids=[idx]
to grow_mol
. Before calling grow_mol
you need to sanitize a molecule Chem.SanitizeMol(fragment)
(that is why you have an error in the second case, after manipulation with a molecule you need to update internal states).
Option 2 (tricky). Replace a dummy atom with a hydrogen, sanitize a molecule and then call mutate_mol
with min_size=0
and max_size=0
. This will replace all explicit hydrogens in a molecule. While you maintain explicit hydrogens at attachment points only you will get what you want. This is less explicit and a more dangerous way.
In the example I decreased the radius to 2, because it cannot find such a context at radius 3 in a database.
idx = None
for atom in fragment.GetAtoms():
if atom.GetAtomicNum() == 0:
idx = atom.GetIdx()
break
frag = Chem.EditableMol(fragment)
frag.ReplaceAtom(idx, Chem.Atom(1))
frag = frag.GetMol()
Chem.SanitizeMol(frag)
res = list(mutate_mol(frag, db_name='replacements.db', max_replacements=9, return_mol=True, min_size=0, max_size=0, radius=2))
from crem.
It seems like removing the dummy atom and running SanitizeMol solved my problems. Thank you for the timely help!
from crem.
Related Issues (20)
- No such table: radius3 HOT 2
- fragmentation py issue: Can't generate mol for: SMILES HOT 6
- Reproducible output HOT 1
- Annoying [13:51:55] WARNING: not removing hydrogen atom with dummy atom neighbors HOT 1
- Problem with guacamol_test.py HOT 1
- AtomKekulizeException: non-ring atom 2 marked aromatic HOT 2
- fragmentation problem HOT 6
- Results different between online app and local version HOT 2
- [bug] package is incompatible with python 3.11+ HOT 1
- auxiliary function get_replacements HOT 2
- Multiple replacements in grow_mol HOT 2
- error of enumerate_compounds function HOT 4
- enumerate_compounds: filtering the generated molecules to meet my criteria HOT 5
- how to employ the grow_mol2/mut_mol2 function HOT 2
- Issue in HOT 3
- Database Visualization and Variation Inquiry HOT 1
- Fragmentation HOT 4
- Parameters relevant for speed in mutate_mol HOT 11
- Opening Pre-Compiled Databases HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crem.