[Biopython] Variation in distance calculation between Bio.PDB and PyMol

João Rodrigues j.p.g.l.m.rodrigues at gmail.com
Tue Feb 27 18:11:20 EST 2024


Hi Salma,

Thanks for the explanation and for attaching a code sample. Running your
script locally returns 1.801. I don't know what pairs of atoms you are
calculating distances for exactly in Pymol, so it's hard to judge what can
be happening.

That said, the ligands in the structure you attached are disordered and
each atom has multiple alternate locations. If you show the atoms as
spheres in Pymol, they might overlap each other and they're hard to see.
Try setting sphere_scale to 0.2 or so and then measure the distances again.
Also, when you do structure.get_atoms(), note that the disordered atoms
don't get unpacked and there's only one of the alternate locations that is
selected. To include all atoms, you have to manually unpack residues like
this:

all_atoms = []
for res in structure.get_residues():
    all_atoms.extend(res.get_unpacked_list())

If I do this in your script I get an average distance of 1.727.

Does this help with your question?

Best,

João
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20240227/2b86cac3/attachment.htm>


More information about the Biopython mailing list