neurosnap.structure.prepare module#
Structure-preparation helpers.
This module provides small structure-level preparation utilities plus thin wrappers around the existing PDB2PQR preparation backend.
The wrappers intentionally do not reimplement that engine. They expose a structure-oriented API while delegating the underlying chemistry logic to the existing algorithm module.
- neurosnap.structure.prepare.add_hydrogens_with_pdb2pqr(structure, *, forcefield='PARSE', ffout=None, neutraln=False, neutralc=False, debump=True)[source]#
Add hydrogens using the PDB2PQR preparation backend.
This wrapper delegates to
neurosnap.algos.pdb2pqr.assign_pqr()withassign_only=Falseandoptimize=False. PDB2PQR may still perform its internal water-specific hydrogen handling, but it skips the full optimization path used byoptimize_hydrogens_with_pdb2pqr().The returned structure is the PDB2PQR-rebuilt structure, so it also carries any charge/radius annotations and provenance metadata that backend emits.
- Return type:
- neurosnap.structure.prepare.add_terminal_capping_groups(structure, *, chains=None, n_terminal=True, c_terminal=True)[source]#
Return a copy with ACE/NME caps added to protein chain termini.
Adds an
ACEheavy-atom cap to each selected chain N-terminus and anNMEheavy-atom cap to each selected chain C-terminus. Coordinates are placed from terminal backbone geometry and should be relaxed by a molecular mechanics tool before downstream workflows that require optimized cap conformations.- Parameters:
- Return type:
- Returns:
New
Structurecontaining the original atoms plus cap atoms and covalent cap bonds.
- neurosnap.structure.prepare.has_hydrogens(structure)[source]#
Return
Trueif the structure currently contains hydrogen atoms.
- neurosnap.structure.prepare.optimize_hydrogens_with_pdb2pqr(structure, *, forcefield='PARSE', ffout=None, neutraln=False, neutralc=False, debump=True)[source]#
Add and optimize hydrogens using the PDB2PQR preparation backend.
This wrapper delegates to
neurosnap.algos.pdb2pqr.assign_pqr()withassign_only=Falseandoptimize=True.The returned structure is the PDB2PQR-rebuilt structure, so it also carries any charge/radius annotations and provenance metadata that backend emits.
- Return type:
- neurosnap.structure.prepare.remove_altlocs_and_duplicate_atoms(structure)[source]#
Return a copy with one atom retained for each residue atom site.
Atom sites are identified by chain ID, residue ID, insertion code, residue name, hetero flag, and atom name. When multiple atoms share a site, the atom with the highest occupancy is retained. Ties prefer a blank alternate location, then alternate location
A, then the first atom in input order.Neurosnap’s PDB/mmCIF parsers already collapse alternate locations while loading. This helper is mainly useful for structures built manually or from workflows that add an
altloc-style annotation column.