Code Monkey home page Code Monkey logo

Comments (10)

ravila4 avatar ravila4 commented on May 28, 2024 1

Hi, I tried the suggested method for calculating charges with xiap, but it didn't work. The bonds were removed, but it still throws the same error as before. Could there be a difference across openbabel versions? I am using 2.4.1.

Also, I tried using the RDKit backend, but it fails with TypeError: category must be a Warning subclass, not 'str'. I think #79 fixes that.

from oddt.

marta-sd avatar marta-sd commented on May 28, 2024 1

You're right, this example doesn't work with OB 2.4.1 and the default model, we'll take a look at that. Meanwhile you can use different model, e.g. MMFF94 works for this one: mol.calccharges('mmff94').

Disclaimer: charging molecules in OB is painful, it is often impossible to find a pipeline that works for all compounds in the database...

And with RDKit you're right again, there was an error in the warning, thank you for fixing it (and welcome to the ODDT team :)) Note, however, that it means that RDKit wasn't able to calculate the charges properly (there are some NaNs etc)

from oddt.

mwojcikowski avatar mwojcikowski commented on May 28, 2024

The remarks partially answer your question, those three columns are:

  • vdW (van der Waals radii)
  • Elec (electrostatic potential)
  • q (partial charge)

You will get partial charge should you generate it beforehand.

Anyhow, Autodock Vina does not use any of those columns. Autodock 4 will use the partial charges, I don't think the vdW and Elec is necessary at all (unless you want to override the default values).

from oddt.

dcm9123 avatar dcm9123 commented on May 28, 2024

Thank you for your fast response. However, could you tell me how to generate these partial charges that you mention beforehand? I was under the impression that this code would generate them for me.
We are using a modified version of NNScore and we are testing different pdbqt files for it. We initially generated pdbqt files using MGLtools ("prepare_protein4.py"), but we noticed that it does not calculate charges for metallic ions in the files. To my knowledge NNScore uses partial charges for scoring.

Thanks in advance.

from oddt.

mwojcikowski avatar mwojcikowski commented on May 28, 2024

Yes, in fact NNscore uses partial charges in computing Coulombic interactions. You can generate partial charges with mol.calccharges() ant they should appear in the PDBQT file. Note, that RDKit does not have this functionality yet. PR is coming soon.

from oddt.

mwojcikowski avatar mwojcikowski commented on May 28, 2024

Finally, you could use NNscore which is implemented in ODDT:

from oddt.scoring.functions import nnscore

According to our tests it performs better than the original one on either PDBbind and DUD-e database. Additionally it is much faster and does not require PDBQT files.

from oddt.

dcm9123 avatar dcm9123 commented on May 28, 2024

Hi! Thank you for your help and for updating oddt! Now it works for almost every molecule. I have successfully generated the partial charges with the proposed function (calccharges), however I have encountered a similar problem as the code from MGL Tools (prepare4_receptor.py), it displays an error whenever it has a metallic ion attached. I have tried with the DUD-E data set, and the proteins that came up with an error are those with metals attached (24 out of 102, containing either Zn, Mg, Fe). For instance, it won't work with ada17, xiap, mpp13, hdac8, hdac2, cp2c9, among others. The error I am getting is the following:

Traceback (most recent call last):
File "oddt_pdbqt_converter.py", line 20, in
receptor.calccharges()
File "/Users/Danniel/miniconda2/lib/python2.7/site-packages/oddt/toolkits/ob.py", line 285, in calccharges
super(Molecule, self).calccharges(model)
File "/Users/Danniel/miniconda2/lib/python2.7/site-packages/pybel.py", line 499, in calccharges
raise Exception(error)
Exception: Molecule failed to charge.

I am using openbabel for this.

Thanks in advance!

from oddt.

mwojcikowski avatar mwojcikowski commented on May 28, 2024

When you read molecule from PDB usually you get zero order bonds coordinating the metal atoms, to which OB is apparently not invariant. I've checked for xiap and following code fixes charge generation

import oddt
mol = next(oddt.toolkit.readfile('pdb', 'xiap_receptor.pdb')
# remove zero order bonds from metals
for atom in mol: 
    if atom.atomicnum == 30:  # Atomic num of treated metals
        for bond in atom.bonds:
            mol.OBMol.DeleteBond(bond.OBBond)

mol.calccharges()

For other atoms change the if to a list of atomic numbers of metals.

from oddt.

mwojcikowski avatar mwojcikowski commented on May 28, 2024

Before our PR #78 the default method for mol.calcchrges was mmff94, which works for xiap. On the other hand gasteiger partial charges are suggested for small molecules, thus we unified that for OB and RDKit by setting default method to gasteiger (the most common use case is small molecule). Secondly, 'mmff94' should work better for proteins and, as pointed out by @marta-sd, they work for xiap so i suggest using it. Gasteiger for proteins is problematic most times.

from oddt.

mwojcikowski avatar mwojcikowski commented on May 28, 2024

I think this discussion drifted apart from the original issue, so I'm going to close this. Open a new issue, should you have other problems.

from oddt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.