salilab/imp

Issue with pmi connectivity restraint at resolutions >1

Closed this issue · 4 comments

The connected residues for connectivity restraint are calculated as follows in PMI/stereochemistry.py:99.

nreslast = len(IMP.pmi.tools.get_residue_indexes(last))
lastresn = IMP.pmi.tools.get_residue_indexes(last)[-1]
nresfirst = len(IMP.pmi.tools.get_residue_indexes(first))
firstresn = IMP.pmi.tools.get_residue_indexes(first)[0]

If evaluating connectivity at resolution 10, nreslast and nresfirst are the correct 2 10-residue beads but lastresn and firstresn are set to the last residue of the first 10-residue bead and the first residue of the follow 10-residue bead.

For example, if nreslast is 413-422_bead and nresfirst is 423-432_bead then as currently implemented, lastresn is set to 422 and firstresn is set to 423. This means that residuegap and therefore the connectivity restraint are computed as if they are neighboring 1-residue beads.

Instead, lastresn should be the middle residues of the 2 10-residue beads (418 and 428 respectively), thus residuegap is correctly calculated.

Are you sure? Looking at the code, the restraint does not use residuegap but rather nreslast / 2 + nresfirst / 2 + residuegap, which should adjust for the center of each bead:
https://github.com/salilab/pmi/blob/develop/pyext/src/restraints/stereochemistry.py#L109-L110

I believe that is only the case if disorderedlength is set to True. The default behavior (line 116) is:

optdist = (0.0 + (float(residuegap) + 1.0) * 3.6) * scale

When disorderedlength is False, the restraint uses a SphereDistancePairScore, which restrains based on the distance between the surfaces of the beads, not their centers. Thus, the residuegap is appropriate.

Closing as we think the existing behavior is correct (at least, the best we can do at this level of representation).