Code Monkey home page Code Monkey logo

Comments (9)

fabricecarles avatar fabricecarles commented on May 28, 2024 1

Thanks again ! Note that the exact module name is rdk ( oddt.toolkit = oddt.toolkits.rdk )

from oddt.

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

Hi Fabrice,

You're using Open Babel as a backend, right?

The idx attribute corresponds to the index used in OB, not to the residue number. However, the original residue numbering isn't lost and you can access it using res.OBResidue.GetNum() (where res is a residue object).

@mwojcikowski Is that intended? I think we should change it (RDKit uses residue number as idx)

from oddt.

fabricecarles avatar fabricecarles commented on May 28, 2024

Hi Marta,
I was using OB backend but in fact I don't know why ! When we use oddt.toolkit.readfile, OB is the default backend ?
Now I have switched the readfile to oddt.toolkits.rdk.readfile and RDKit seem to be the new backend with residue number as idx. This is exactetly what I want, perfect !
Thanks

from oddt.

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

If you have both RDKit and Open Babel installed, the latter is used by default.
You can change this behavior by setting ODDT_TOOLKIT env variable to rdkit, or by putting oddt.toolkit = oddt.toolkits.rdkit inside your script.

from oddt.

mwojcikowski avatar mwojcikowski commented on May 28, 2024

Sure, I think we should change the indexing in OB, although the idx property is taken from OpenBabel's GetIdx vs GetNum. Maybe we should make a distinction between them and create Residue.number property and fix Residue.idx as an 0-based index for RDKit.

from oddt.

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

Sounds reasonable

from oddt.

fabricecarles avatar fabricecarles commented on May 28, 2024

Hi,
In version 0.5 of oddt I was using
oddt.toolkit = oddt.toolkits.rdk #  force rdkit backend
By default oddt was not renumbering residue id in protein input file.
Since version oddt 0.6 with same rdkit backend the default behavior is now to renumbering.

How can I force oddt 0.6 (rdkit) to keep again the original numbering (including gap) ?

Could you provide some code example

Tanks

from oddt.

mwojcikowski avatar mwojcikowski commented on May 28, 2024

ODDT 0.6 introduced residue number property which maps to PDB numbering. idx which was previously that number is used as an consecutive index to match that of OpenBabel. So if I understand correctly all you need to do is to use Residue.number instead of Residue.idx (see the docs). If you have further problems please open new issue with a bit of code showing the changed behavior.

from oddt.

mwojcikowski avatar mwojcikowski commented on May 28, 2024

Here is a bit of code that prints PDB numbering with

import oddt
oddt.toolkit = oddt.toolkits.rdk #  force rdkit backend
mol = next(oddt.toolkit.readfile('pdb', 'tests/data/dude/xiap/receptor_rdkit.pdb'))
for res in mol.residues:
    print(res.number)

If you want to use atom_dict you need to mark a molecule as a protein:

import oddt
oddt.toolkit = oddt.toolkits.rdk #  force rdkit backend
mol = next(oddt.toolkit.readfile('pdb', 'tests/data/dude/xiap/receptor_rdkit.pdb'))
mol.protein = True
print(mol.atom_dict['resnum'])

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.