{
  "id": 500893,
  "title": "[QUESTION] [SOLVED] RDKit Error in 3d Image processing",
  "url": "/competitions/leash-BELKA/discussion/500893",
  "author_name": "",
  "post_date": "2024-05-07T10:09:50.568737700Z",
  "votes": 1,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Hi everyone,</p>\n<p>I was testing a bit with multiple kinds of representations for the molecules, and two warnings keep popping up</p>\n<pre><code>UFFTYPER: Unrecognized atom type: Dy5+... (...)\nUFFTYPER: Unrecognized charge   atom: ...\n</code></pre>\n<p>Where … is a random number. Now I tried using </p>\n<pre><code>logger = RDLogger.logger()\nlogger.setLevel(RDLogger.ERROR)\nwarnings.filterwarnings()\n</code></pre>\n<p>and</p>\n<pre><code>mol = Chem.MolFromSmiles(smiles)\nme = Chem.MolFromSmiles()\ndy = Chem.MolFromSmiles()\nmol = AllChem.ReplaceSubstructs(mol, me, dy)[]\n</code></pre>\n<p>but to no avail. Any suggestions?</p>\n<p>Note: the first problem arises from</p>\n<pre><code>  mol.GetNumConformers():\n        AllChem.EmbedMolecule(mol)\n</code></pre>\n<p>while the second is most likely coming from</p>\n<pre><code> atom  mol.GetAtoms():\n        formal_charge = atom.GetFormalCharge()  atom.GetFormalCharge()  - \n</code></pre>\n<p>Now, it doesn't really change the output because in the first case, a conformer is still created while in the second, simply a \"sentinel\" value is put, so the only thing it does really is clogging my logs</p>\n<p>Edit: no after some more thorough exploration, the first part is very problematic because the coordinates given are just non-sensical</p>",
  "messages": [
    {
      "id": "2798627",
      "postDate": "05/07/2024 10:09:50",
      "content": "<p>Hi everyone,</p>\n<p>I was testing a bit with multiple kinds of representations for the molecules, and two warnings keep popping up</p>\n<pre><code>UFFTYPER: Unrecognized atom type: Dy5+... (...)\nUFFTYPER: Unrecognized charge   atom: ...\n</code></pre>\n<p>Where … is a random number. Now I tried using </p>\n<pre><code>logger = RDLogger.logger()\nlogger.setLevel(RDLogger.ERROR)\nwarnings.filterwarnings()\n</code></pre>\n<p>and</p>\n<pre><code>mol = Chem.MolFromSmiles(smiles)\nme = Chem.MolFromSmiles()\ndy = Chem.MolFromSmiles()\nmol = AllChem.ReplaceSubstructs(mol, me, dy)[]\n</code></pre>\n<p>but to no avail. Any suggestions?</p>\n<p>Note: the first problem arises from</p>\n<pre><code>  mol.GetNumConformers():\n        AllChem.EmbedMolecule(mol)\n</code></pre>\n<p>while the second is most likely coming from</p>\n<pre><code> atom  mol.GetAtoms():\n        formal_charge = atom.GetFormalCharge()  atom.GetFormalCharge()  - \n</code></pre>\n<p>Now, it doesn't really change the output because in the first case, a conformer is still created while in the second, simply a \"sentinel\" value is put, so the only thing it does really is clogging my logs</p>\n<p>Edit: no after some more thorough exploration, the first part is very problematic because the coordinates given are just non-sensical</p>",
      "rawMarkdown": "Hi everyone,\n\nI was testing a bit with multiple kinds of representations for the molecules, and two warnings keep popping up\n```\nUFFTYPER: Unrecognized atom type: Dy5+... (...)\nUFFTYPER: Unrecognized charge state for atom: ...\n```\nWhere ... is a random number. Now I tried using \n```python\nlogger = RDLogger.logger()\nlogger.setLevel(RDLogger.ERROR)\nwarnings.filterwarnings(\"ignore\")\n```\nand\n```python\nmol = Chem.MolFromSmiles(smiles)\nme = Chem.MolFromSmiles('C')\ndy = Chem.MolFromSmiles('[Dy]')\nmol = AllChem.ReplaceSubstructs(mol, me, dy)[0]\n```\nbut to no avail. Any suggestions?\n\nNote: the first problem arises from\n```python\nif not mol.GetNumConformers():\n        AllChem.EmbedMolecule(mol)\n```\nwhile the second is most likely coming from\n```python\nfor atom in mol.GetAtoms():\n        formal_charge = atom.GetFormalCharge() if atom.GetFormalCharge() else -1 \n```\nNow, it doesn't really change the output because in the first case, a conformer is still created while in the second, simply a \"sentinel\" value is put, so the only thing it does really is clogging my logs\n\nEdit: no after some more thorough exploration, the first part is very problematic because the coordinates given are just non-sensical",
      "votes": null
    },
    {
      "id": "2799655",
      "postDate": "05/07/2024 21:17:44",
      "content": "<p>Perhaps try Chem.SanitizeMol(mol) after replacing the Dy with a methyl group?</p>\n<p>Also, are you adding hydrogens before getting the 3D conformer?</p>",
      "rawMarkdown": "Perhaps try Chem.SanitizeMol(mol) after replacing the Dy with a methyl group?\n\nAlso, are you adding hydrogens before getting the 3D conformer?",
      "votes": null
    },
    {
      "id": "2799659",
      "postDate": "05/07/2024 21:21:15",
      "content": "<p>Also, try switching the me and dy in your code. I think you might be replacing methyl groups with Dy? Visualize the resulting molecule to make sure the Dy is gone. </p>\n<p>Sorry if I've got this backwards, I'm on my phone and can't check it.</p>",
      "rawMarkdown": "Also, try switching the me and dy in your code. I think you might be replacing methyl groups with Dy? Visualize the resulting molecule to make sure the Dy is gone. \n\nSorry if I've got this backwards, I'm on my phone and can't check it.",
      "votes": null
    },
    {
      "id": "2799905",
      "postDate": "05/08/2024 03:22:22",
      "content": "<p>I’m actually stupid, yes that’s the problem. Thank you very much</p>",
      "rawMarkdown": "I’m actually stupid, yes that’s the problem. Thank you very much",
      "votes": null
    },
    {
      "id": "2800848",
      "postDate": "05/08/2024 11:36:15",
      "content": "<p>Not stupid, it's an easy mistake </p>",
      "rawMarkdown": "Not stupid, it's an easy mistake",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2799655,
      "author_name": "chemdatafarmer",
      "author_url": "",
      "post_date": "05/07/2024 21:17:44",
      "content": "<p>Perhaps try Chem.SanitizeMol(mol) after replacing the Dy with a methyl group?</p>\n<p>Also, are you adding hydrogens before getting the 3D conformer?</p>",
      "votes": null,
      "replies": [
        {
          "id": 2799659,
          "author_name": "chemdatafarmer",
          "author_url": "",
          "post_date": "05/07/2024 21:21:15",
          "content": "<p>Also, try switching the me and dy in your code. I think you might be replacing methyl groups with Dy? Visualize the resulting molecule to make sure the Dy is gone. </p>\n<p>Sorry if I've got this backwards, I'm on my phone and can't check it.</p>",
          "votes": null,
          "replies": [
            {
              "id": 2799905,
              "author_name": "giorgiomicaletto",
              "author_url": "",
              "post_date": "05/08/2024 03:22:22",
              "content": "<p>I’m actually stupid, yes that’s the problem. Thank you very much</p>",
              "votes": null,
              "replies": [
                {
                  "id": 2800848,
                  "author_name": "chemdatafarmer",
                  "author_url": "",
                  "post_date": "05/08/2024 11:36:15",
                  "content": "<p>Not stupid, it's an easy mistake </p>",
                  "votes": null,
                  "replies": []
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2798627": "Hi everyone,\n\nI was testing a bit with multiple kinds of representations for the molecules, and two warnings keep popping up\n```\nUFFTYPER: Unrecognized atom type: Dy5+... (...)\nUFFTYPER: Unrecognized charge state for atom: ...\n```\nWhere ... is a random number. Now I tried using \n```python\nlogger = RDLogger.logger()\nlogger.setLevel(RDLogger.ERROR)\nwarnings.filterwarnings(\"ignore\")\n```\nand\n```python\nmol = Chem.MolFromSmiles(smiles)\nme = Chem.MolFromSmiles('C')\ndy = Chem.MolFromSmiles('[Dy]')\nmol = AllChem.ReplaceSubstructs(mol, me, dy)[0]\n```\nbut to no avail. Any suggestions?\n\nNote: the first problem arises from\n```python\nif not mol.GetNumConformers():\n        AllChem.EmbedMolecule(mol)\n```\nwhile the second is most likely coming from\n```python\nfor atom in mol.GetAtoms():\n        formal_charge = atom.GetFormalCharge() if atom.GetFormalCharge() else -1 \n```\nNow, it doesn't really change the output because in the first case, a conformer is still created while in the second, simply a \"sentinel\" value is put, so the only thing it does really is clogging my logs\n\nEdit: no after some more thorough exploration, the first part is very problematic because the coordinates given are just non-sensical",
    "2799655": "Perhaps try Chem.SanitizeMol(mol) after replacing the Dy with a methyl group?\n\nAlso, are you adding hydrogens before getting the 3D conformer?",
    "2799659": "Also, try switching the me and dy in your code. I think you might be replacing methyl groups with Dy? Visualize the resulting molecule to make sure the Dy is gone. \n\nSorry if I've got this backwards, I'm on my phone and can't check it.",
    "2799905": "I’m actually stupid, yes that’s the problem. Thank you very much",
    "2800848": "Not stupid, it's an easy mistake"
  },
  "source": "meta"
}