Skip to content

DSSP: multi-chain systems fail with guess_hydrogens=False, and residues after a gap form spurious H-bonds #5505

Open

Description

@BradyAJohnston

Expected behavior

That the DSSP handles a protein with more than one chain, or gaps (missing residues) as the original DSSP does: the first residue of a chain and the first residue after a break aren't hydrogen bond donors.

Actual behavior

DSSP treats the whole selection as one continuous chain, and exempts only its first residue. This causes two problems:

  • guess_hydrogens=False rejects every system with more than one chain
  • guess_hydrogen=True the first residue of each later chain and each residue after a gap still donate hydrogens

Code to reproduce the behavior

import warnings

import MDAnalysis as mda
import numpy as np
from MDAnalysis.analysis.dssp import DSSP
from MDAnalysisTests.datafiles import TPR, XTC

warnings.filterwarnings("ignore")

protein = mda.Universe(TPR, XTC).select_atoms("protein")
protein.unwrap()  # the protein is split across the periodic box

# 1. two chains: the second chain's N-terminal MET has three hydrogens
two_chains = mda.Merge(protein, protein)
two_chains.atoms[protein.n_atoms :].translate([100, 0, 0])
try:
    DSSP(two_chains, guess_hydrogens=False)
    print("1. two chains, guess_hydrogens=False: OK")
except ValueError as e:
    print(f"1. two chains, guess_hydrogens=False: ValueError: {e}")

# 2. residues 78-80 (indices 77-79) removed: residue 81 follows the gap
n = protein.n_residues
intact = "".join(DSSP(mda.Merge(protein)).run().results.dssp[0])
keep = np.r_[0:77, 80:n]
gapped = "".join(
    DSSP(mda.Merge(protein.residues[keep].atoms)).run().results.dssp[0]
)
print("2. intact chain, and with residues 78-80 removed:")
for i, original in [(1, 1), (77, 80)]:
    residue = protein.residues[original]
    print(
        f"   {residue.resname} {residue.resid}: intact {intact[original]!r}, "
        f"with the gap {gapped[i]!r}"
    )
1. two chains, guess_hydrogens=False: ValueError: Residue <Residue MET, 1> contains wrong number of hydrogens: exactly 1 hydrogen is expected for non-PRO residues, and zero hydrogens for PRO residues.
2. intact chain, and with residues 78-80 removed:
   ARG 2: intact '-', with the gap 'E'
   PHE 81: intact '-', with the gap 'E'

Current version of MDAnalysis

  • MDAnalysis 2.11.0-dev0 (develop, 6cd1f7e58); also seen with 2.10.0
  • Python 3.12.13
  • Linux

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions