Skip to content

Instantly share code, notes, and snippets.

@ptosco
Created August 24, 2020 13:21
Show Gist options
  • Save ptosco/a9b9bc5309e3114b89fcc4aefdef9f57 to your computer and use it in GitHub Desktop.
Save ptosco/a9b9bc5309e3114b89fcc4aefdef9f57 to your computer and use it in GitHub Desktop.
RenumberAtoms2
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from rdkit import Chem"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"m1 = Chem.AddHs(Chem.MolFromSmiles('NC(C)C(=O)O'))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"for a in m1.GetAtoms():\n",
" a.SetAtomMapNum(a.GetIdx())"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAcIAAACWCAIAAADCEh9HAAAABmJLR0QA/wD/AP+gvaeTAAAgAElEQVR4nO3dd1xUx9oH8N+yFOkdFREFZWlSFEW4m6AIEY29gMaWRCzRq0ZNjJqYqJcQWzDNYDSxvXo1CoqFmBijolgQwatioYoUEaQKAi6we94/jtmsy4rUPYs830/+WGZOedbow5yZOTM8hmFACCGkudS4DoAQQto3SqOEENIilEYJIaRFKI0SQkiLUBolhJAWUec6AMKF2lo8fIjqalhawtCwUaeUlYFhoKEBPb02Do6QdoZaox1MTg5mzICxMWxs4OQEExN4eeHUqVecdfYsTExgYoIJE5QSJSHtCaXRjiQjAwMHIiICs2bhxAmcPo2vv0Z+PoYPx/btLz2rshLBwfDwgIGBEmMlpN3g0fT7DmTQIFy6hD//xJAh/xQWF0MoxIMHuHsXtrYKzlq8GFu24OpV+PvD0/PVTVdCOhhqjXYYN2/iwgVMmvRCDgVgaooNGyASYds2BWfFx2PLFixcCA8P5YRJSLtDabTDOH8eAHx9FVQNGwYNjecHhIZi0iSIRABQ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JCTEzM5NLo8eOHXv33XfLy8sdHBzYCQBXrlw5evSocsMnXKI0SshzXbp0aeopd+7cmTRpUo8ePS5fvuzk5ASgurq6qqqqDaIjqovSKCHNFxISIhKJDhw4wOZQANra2nK72pHXHs0bJaRpnj17dv/+/ZKSErFYHB0d3adPn379+nEdFOEStUYJUSA7OzspKUm2RDo//9q1az4+PsuXL3///fcrKyudnJzOnz+/c+fOjIwMCwuLyZMnByltJ1KiGiiNEqLAhx9++LIqCwuLqVOn9u3bt7i4GEBsbOzRo0fffPPNrl27Xr16NSoq6tq1a5s2bVJisIRjlEYJUSA0NPSNN96QLUlISPjoo48A2Nvb79u3D8CFCxcAdO3a9cqVK+wMp6qqKh8fn7CwsDlz5tjZ2XEROOEApVFCFHBycvJ5cc8mkUgkd4yBgQEAd3d36SxRHR2dmTNnJiYmXrx4kdJox0FDTIQ0k52dHZ/PT01NlS1k91AhHQqlUUKaRiKRVFdX19XV6erqDho06PLly8nJyWwVwzDsxqheXl6cxkiUitIoIU1z6dIlHR2dVatWAVizZo2ampq/v/+WLVuioqLGjh177ty5adOmOTo6ch0mUR7qGyWkaYyMjIYMGdK7d28Ab7755pEjR5YsWbJw4UIAenp6H3/88Zdffsl1jESpaGkSQl4gFotFIpGWlhafz5ctl0gkz54909TUVFdX0PjIzc2tqqrq0aOHlpaWsiIlqoLSKCGEtAj1jRJCSItQGiWEkBahNEoIIS1CaZQQQlqE0ighhLTI/wMrawgELuvaKQAAAABJRU5ErkJggg==\n",
"text/plain": [
"<rdkit.Chem.rdchem.Mol at 0x7f7c031dc210>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m1"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"ps = Chem.SmilesParserParams()\n",
"ps.removeHs = False\n",
"m2 = Chem.MolFromSmiles(Chem.MolToSmiles(m1), ps)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {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qEEOoSTKMIvY/Y2NiAgICWlhYul8tms+vq6gCAw+Gw2Wxys6m6ujo2m83lcgGAzWaz2Ww+n09z0Eg6MI0i9D6KioquXLnC5/N37NjBZDKNjY0BIDQ0lMlkLl++HAAsLCyYTOZ3330nEAiYTCaTyRS+5Ue9DM6pR6hjz58/Ly0tZbFYopuINDc3FxYWDho0SF1dnSx59uxZeXm56Af79+9vYmKSnZ0tnOxEsrOzU1ZWpiByRDFMowgh1CXYqEcIoS7BNIoQQl2CaRQhhLoE0yhCCHUJplGEEOqS/wOd3ICSUTchNwAAAABJRU5ErkJggg==\n",
"text/plain": [
"<rdkit.Chem.rdchem.Mol at 0x7f7c031eb0d0>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m2"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 0 N\n",
"1 1 C\n",
"2 2 C\n",
"3 9 H\n",
"4 10 H\n",
"5 11 H\n",
"6 3 C\n",
"7 4 O\n",
"8 5 O\n",
"9 12 H\n",
"10 8 H\n",
"11 6 H\n",
"12 7 H\n"
]
}
],
"source": [
"for a in m2.GetAtoms():\n",
" print(a.GetIdx(), a.GetAtomMapNum(), a.GetSymbol())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Quoting from the RDKit docs:<br />\n",
"http://rdkit.org/docs/source/rdkit.Chem.rdmolops.html?highlight=renumberatoms#rdkit.Chem.rdmolops.RenumberAtoms<br />\n",
"Returns a copy of a molecule with renumbered atoms<br />\n",
"ARGUMENTS:\n",
"* `mol`: the molecule to be modified\n",
"* `newOrder`: the new ordering the atoms (should be `numAtoms` long) for example: if newOrder is `[3,2,0,1]`, then atom `3` in the original molecule will be atom `0` in the new one\n",
"\n",
"So you need to resort `new_order` as follows:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"new_order = tuple(zip(*sorted([(j, i) for i, j in enumerate([a.GetAtomMapNum() for a in m2.GetAtoms()])])))[1]"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0, 1, 2, 6, 7, 8, 11, 12, 10, 3, 4, 5, 9)"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"new_order"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n"
]
}
],
"source": [
"m3 = Chem.RenumberAtoms(m2, new_order)\n",
"print([a.GetAtomMapNum() for a in m3.GetAtoms()])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now the order is the expected one:"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 0 N\n",
"1 1 C\n",
"2 2 C\n",
"3 3 C\n",
"4 4 O\n",
"5 5 O\n",
"6 6 H\n",
"7 7 H\n",
"8 8 H\n",
"9 9 H\n",
"10 10 H\n",
"11 11 H\n",
"12 12 H\n"
]
}
],
"source": [
"for a in m3.GetAtoms():\n",
" print(a.GetIdx(), a.GetAtomMapNum(), a.GetSymbol())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.11"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment