Open AlanTanKX opened 1 year ago
Could you provide an example of what you want and what you want to avoid? Because after the first iteration you will get molecules where every out of 3 selected positions will be used for growing. So, molecules after the first iteration will already satisfy your criterion.
Sorry for the unclear post. For example, my replace_ids = [2, 4, 6]
, with n_iterations = 3
. I only want molecules in which ids 2 and either one of 4, 6, or both are replaced. I want id 2 to always be replaced.
For example, a scenario I want to avoid would be if 4 and 6 are replaced without id 2.
In this case you may separately generate derivatives at position 2 and afterwards supply those molecules one by one to enumerate_compounds
function and provide further positions to be substituted.
The issue here will be to determine proper positions (4 and 6) after the first growing because atom indices may change. This could be solved to assign a custom label to atoms which you want to expand further (atom.SetProp
), but in crem
these labels are lost after transformations. As a workaround you can assign isotope labels to these atoms, these labels will survive.
I do not know why but for some reasons isotope labels do not contradict with determination of context and replacements. It seems I get the same set of molecules if I set an isotope label and if not. However, there could be some other side effects, which I cannot predict now.
m = Chem.MolFromSmiles('c1cncc(Cl)c1')
mols1 = list(grow_mol(m, 'replacements_sa2_f5.db'))
m.GetAtomWithIdx(1).SetIsotope(30)
mols2 = list(grow_mol(m, 'replacements_sa2_f5.db'))
mols1
['Clc1cncc(Br)c1', 'Cc1cncc(Cl)c1', 'Clc1cncc(Cl)c1', 'COc1cncc(Cl)c1', 'Fc1cncc(Cl)c1', 'Nc1cncc(Cl)c1', 'Oc1cncc(Cl)c1',
'OCc1cncc(Cl)c1', 'Cc1ccc(Cl)cn1', 'CCc1ccc(Cl)cn1', 'CNc1ccc(Cl)cn1', 'COc1ccc(Cl)cn1', 'CSc1ccc(Cl)cn1', 'Nc1ccc(Cl)cn1',
'N#Cc1ccc(Cl)cn1', 'NCc1ccc(Cl)cn1', 'OCc1ccc(Cl)cn1', 'Clc1cnccc1Br', 'Cc1ccncc1Cl', 'C=Cc1ccncc1Cl', 'Clc1ccncc1Cl',
'COc1ccncc1Cl', 'Fc1ccncc1Cl', 'N#Cc1ccncc1Cl', 'NCc1ccncc1Cl', 'Oc1ccncc1Cl', 'OCc1ccncc1Cl']
mols2
['Clc1cn[30cH]c(Br)c1', 'Cc1cc(Cl)cn[30cH]1', 'Clc1cn[30cH]c(Cl)c1', 'COc1cc(Cl)cn[30cH]1', 'Fc1cc(Cl)cn[30cH]1',
'Nc1cc(Cl)cn[30cH]1', 'Oc1cc(Cl)cn[30cH]1', 'OCc1cc(Cl)cn[30cH]1', 'C[30c]1ccc(Cl)cn1', 'CC[30c]1ccc(Cl)cn1',
'CN[30c]1ccc(Cl)cn1', 'CO[30c]1ccc(Cl)cn1', 'CS[30c]1ccc(Cl)cn1', 'N[30c]1ccc(Cl)cn1', 'N#C[30c]1ccc(Cl)cn1',
'NC[30c]1ccc(Cl)cn1', 'OC[30c]1ccc(Cl)cn1', 'Clc1cn[30cH]cc1Br', 'Cc1c[30cH]ncc1Cl', 'C=Cc1c[30cH]ncc1Cl',
'Clc1c[30cH]ncc1Cl', 'COc1c[30cH]ncc1Cl', 'Fc1c[30cH]ncc1Cl', 'N#Cc1c[30cH]ncc1Cl', 'NCc1c[30cH]ncc1Cl',
'Oc1c[30cH]ncc1Cl', 'OCc1c[30cH]ncc1Cl']
Okay, will try this out. Thanks!
Hi, I worked around this problem using MCS moldrug.utils.update_reactant_zone. However, this approach still comes with some caveats that are discussed at the bottom of this tutorial
Hi,
I am using the
enumerate_compounds
function to generate new molecules, with 3 positions for potential replacement. Hence, I set then_iterations = 3
. As far as I'm aware, this does a stepwise growing of my base moleculemol
.However, I am only interested in the generated molecules where at least 1 specified position is grown. Is there any way to filter out molecules which don't meet this criteria, or how do you suggest I go about this problem?
Thank you so much!