Skip to content

Commit

Permalink
better fix for rdkit error
Browse files Browse the repository at this point in the history
  • Loading branch information
qcampbel committed Feb 28, 2025
1 parent fde6a31 commit 7e4ab0b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion paper2_LIME/RF-lime.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
")\n",
"#drop smile with containing 'P'\n",
"soldata = soldata[soldata[\"SMILES\"].str.contains(\"P\") == False]\n",
"#drop smile where rdkit.Chem.MolFromSmiles return None\n",
"soldata = soldata[soldata[\"SMILES\"].apply(lambda smiles: rdkit.Chem.MolFromSmiles(smiles) is not None)]\n",
"\n",
"\n",
"features_start_at = list(soldata.columns).index(\"MolWt\")"
]
Expand Down Expand Up @@ -84,7 +87,7 @@
")\n",
"\n",
"# make subsample from pandas df\n",
"molecules = [mol for smi in soldata.SMILES if (mol := rdkit.Chem.MolFromSmiles(smi)) is not None]\n",
"molecules = [rdkit.Chem.MolFromSmiles(smi) for smi in soldata.SMILES]\n",
"\n",
"raw_features = []\n",
"for e, c in zip(molecules, calc.map(molecules, quiet=True)):\n",
Expand Down

0 comments on commit 7e4ab0b

Please sign in to comment.