8000 Conformer Generation might fail within EmbedAlignScore() leading to ValueError: ```Bad Conformer Id``` · Issue #34 · hesther/espsim · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Conformer Generation might fail within EmbedAlignScore() leading to ValueError: Bad Conformer Id #34

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

Open
Foly93 opened this issue Feb 15, 2025 · 1 comment

Comments

@Foly93
Copy link
Foly93 commented Feb 15, 2025

Issue Description:
Within the EmbedAlignScore(), the function GetCrippenO3A() with molecules containing multiple conformers, encounters a 'ValueError: Bad Conformer Id error.' This error occurs inconsistently, meaning that some molecules result in this error and some won't. The error can be mitigated by changing the random seed or the number of conformers.

Current Workaround:
I implemented a simple try-except statement to catch this error in two nested loops where GetCrippenO3A() is called:

for i in range(refNumConfs):
    for j in range(prbNumConfs):
        try:
            alignment = rdMolAlign.GetCrippenO3A(prbMol, refMol, prbCrippen, refCrippen, j, i)
            alignment.Align()
            shape = GetShapeSim(prbMol,refMol,j,i)
            if shape>shapeSim:
                shapeSim=shape
                prbBestConf=j
                refBestConf=i
        except ValueError as e:
            print(f"Failed for Conformers {i} and {j}.")

And similarly in another section:

for i in range(refNumConfs):
    for j in range(prbNumConfs):
        try:
            alignment = rdMolAlign.GetCrippenO3A(prbMol, refMol, prbCrippen, refCrippen, j, i)
            alignment.Align()
            score = GetEspSim(prbMol,refMol,j,i,prbCharge,refCharges[idx],metric,integrate,
                              partialCharges,renormalize,customrange,marginMC,nMC,basisPsi4,
                              methodPsi4,gridPsi4,randomseed=randomseed)
            if score>espSim:
                espSim=score
            shape = GetShapeSim(prbMol,refMol,j,i)
            if shape>shapeSim:
                shapeSim=shape
        except ValueError as e:
            print(f"Failed for Conformers {i} and {j}.")

Suggested Improvement:
While the current try-except workaround prevents the program from crashing, it means that fewer conformer pairs than specified are actually tested. A more robust solution would be to handle this during conformer generation, ensuring that all generated conformer IDs are valid before the alignment step. This would maintain the expected number of conformer comparisons and potentially improve the reliability of the results.

@hesther
Copy link
Owner
hesther commented Feb 17, 2025

Thanks for the bug report, that should definitely be catched on our side - I am very busy currently so it will be 1-2 weeks for a fix, sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0