neurosnap.io.pqr module#

PQR writer for Structures annotated with partial charge and radius.

neurosnap.io.pqr.save_pqr(structure, pqr, *, include_header=False, keep_chain=True)[source]#

Save an annotated Structure as a PQR file.

Parameters:
  • structure (Structure) – Single-model structure annotated with partial_charge and radius.

  • pqr (Union[str, Path, IOBase]) – Output filepath or open file handle.

  • include_header (bool) – Whether to include the stored pdb2pqr_header metadata when present.

  • keep_chain (bool) – Whether to include chain IDs in the written PQR records.

Example

Save a structure returned by neurosnap.algos.pdb2pqr.assign_pqr():

from neurosnap.io.pdb import parse_pdb
from neurosnap.algos.pdb2pqr import assign_pqr
from neurosnap.io.pqr import save_pqr

structure = parse_pdb("tests/files/1BTL.pdb", return_type="ensemble").first()
pqr_structure = assign_pqr(structure, forcefield="AMBER", assign_only=True)
save_pqr(pqr_structure, "test_output.pqr", include_header=True)