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

apply_template'_error #13

Open
AdamAdonyi opened this issue May 26, 2024 · 0 comments
Open

apply_template'_error #13

AdamAdonyi opened this issue May 26, 2024 · 0 comments

Comments

@AdamAdonyi
Copy link

Hi,

I try to use the retrosynthetic notebook and I managed to get everything except the "apply_template" where I got the following error:

NameError Traceback (most recent call last)
in <cell line: 2>()
1 prod_1 = rxn_example.split('>>')[1]
----> 2 pred_reactants = apply_template(tplt_example, prod_1)
3
4 # This is the result of applying the template.
5 visualize_mols(pred_reactants[0])

/content/utils.py in apply_template(tmplt, reacts)
47
48 def apply_template(tmplt, reacts):
---> 49 rxn = rdChemReactions.ReactionFromSmarts(tmplt)
50 reactants = [Chem.MolFromSmiles(x) for x in reacts.split('.')]
51 products = rxn.RunReactants(reactants)

NameError: name 'rdChemReactions' is not defined

in the utils.py the function is the following:

def apply_template(tmplt, reacts):
rxn = rdChemReactions.ReactionFromSmarts(tmplt)
reactants = [Chem.MolFromSmiles(x) for x in reacts.split('.')]
products = rxn.RunReactants(reactants)
return products

the rdChemReactions is properly imported I think (I tried manually/separated as well) but what I am able to run it properly only if the input is something like this "'C:1O.[N:3]>>C:1[N:3]'" not the product of the previous function.

https://www.rdkit.org/docs/source/rdkit.Chem.rdChemReactions.html

The notebook is amazing and I am looking forward to use it.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant