cole-group / FEgrow

An Open-Source Molecular Builder and Free Energy Preparation Workflow
https://cole-group.github.io/FEgrow/
MIT License
113 stars 19 forks source link

Drop unwanted molecules #72

Open velocirraptor23 opened 2 months ago

velocirraptor23 commented 2 months ago

Hi,

I was wondering if there is a way to drop unwanted molecules after the toxicity prediction. Just to filter before to perfomr the conformer generation or the optimization. Might reduce the time of run.

Best wishes,

Cesar

bieniekmateusz commented 2 months ago

This sounds like a useful feature.

ChemSpace has an attribute .df which is a pandas dataframe. That is basically its database. I think you should be able to overwrite it with:

cs.df = cs.df without all the toxicity

This could be a nice addition to the tutorial to show how to subtract the indices from the .toxicity(). Please let me know if you need help there, I should have a few minutes in the evening!

velocirraptor23 commented 2 months ago

I will try this. I will let you know if it worked.

Cesar

velocirraptor23 commented 2 months ago

I have tried this to drop bad molecules:

dft = pd.DataFrame(cs.toxicity())
list1 = dft.index[dft['has_unwanted_subs']==True].tolist()
list2 = dft.index[dft['has_pains']==True].tolist()
list3 = dft.index[dft['has_prob_fgs']==True].tolist()
list4 = dft.index[dft['synthetic_accessibility']< 6.5].tolist()
merged_list = list(set(list1+list2+list3+list4))
cs.df=cs.df.drop(merged_list, errors='ignore')

Seems to work at the moment.

Best wishes,

Cesar