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

EmbedMolecule() returns the coordinates 0, 0, 0 for some peptides derived from MolFromHELM #7439

Closed
KYU49 opened this issue May 14, 2024 · 2 comments
Labels

Comments

@KYU49
Copy link

KYU49 commented May 14, 2024

Describe the bug
After version 2024_03_1, which changes EmbedMolecule() incompatibly, EmbedMolecule() returns the coodinates 0, 0, 0 for all atoms of some peptides derived from MolFromHELM.
e.g.

ATOM      1  N   PHE A   1       0.000   0.000   0.000  1.00  0.00           N  
ATOM      2  CA  PHE A   1       0.000   0.000   0.000  1.00  0.00           C  
ATOM      3  C   PHE A   1       0.000   0.000   0.000  1.00  0.00           C  
...

To Reproduce
The below python codes works well on rdkit ver. 2023.03.3, but it does not work for seq3 on ver. 2024.03.2.

    seq1 = "GGGGGGG"    # EmbedMolecule() works well
    seq2 = "FFFFFF"     # EmbedMolecule() works well
    seq3 = "FFFFFFF"    # EmbedMolecule() returns coordinates 0, 0, 0 without any error

    tempPdbName = "./" + seq1 + ".pdb"
    m = Chem.MolFromHELM("PEPTIDE1{" + str.join(".", list(seq1)) + "}$$$$")
    AllChem.EmbedMolecule(m)
    Chem.MolToPDBFile(m, tempPdbName)

    tempPdbName = "./" + seq2 + ".pdb"
    m = Chem.MolFromHELM("PEPTIDE1{" + str.join(".", list(seq2)) + "}$$$$")
    AllChem.EmbedMolecule(m)
    Chem.MolToPDBFile(m, tempPdbName)
    
    tempPdbName = "./" + seq3 + ".pdb"
    m = Chem.MolFromHELM("PEPTIDE1{" + str.join(".", list(seq3)) + "}$$$$")
    AllChem.EmbedMolecule(m)
    Chem.MolToPDBFile(m, tempPdbName)

Expected behavior
The pdb files of seq3 has non-zero coodinates like seq1 and seq2.

Configuration (please complete the following information):

  • RDKit version: 2024_03_1 (not work), 2023_03_3 (work well)
  • OS: Windows 10
  • Python version (if relevant): 3.9
  • Are you using conda?: Yes
  • If you are using conda, which channel did you install the rdkit from?: conda-forge
@KYU49 KYU49 added the bug label May 14, 2024
@joseerlang
Copy link

Hi there ,

following the documentation of the code you provide, it seems that the problem you have is that you are missing to explicitly add the hydrogens to the molecule before calling the EmbedMolecule method. With the code below you should be fine with the seq3 case. The change from what I see in Greg's source code @greglandrum , is made in this ticket #3807

import rdkit
from rdkit.Chem import AllChem,rdmolops
from rdkit import Chem
seq1 = "GGGGGGG"    # EmbedMolecule() works well
seq2 = "FFFFFF"     # EmbedMolecule() works well
seq3 = "FFFFFFF"    # EmbedMolecule() returns coordinates 0, 0, 0 without any error

tempPdbName = "./" + seq3 + ".pdb"
m = Chem.MolFromHELM("PEPTIDE1{" + str.join(".", list(seq3)) + "}$$$$",)
m= rdmolops.AddHs(m)
AllChem.EmbedMolecule(m)
Chem.MolToPDBFile(m, tempPdbName)

@KYU49
Copy link
Author

KYU49 commented May 28, 2024

Thank you for your help. I was struggling to understand the cause of the problem, so your guidance was very helpful. I checked the ticket you mentioned, and it seems that displaying an error would make it clearer.

@KYU49 KYU49 closed this as completed May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants