neurosnap.structure.filters module#

Convenience structure-filtering functions.

neurosnap.structure.filters.fix_nucleic_termini(structure, *, strip_3prime=False, chain=None)[source]#

Normalize nucleotide phosphate names and strip terminal phosphate atoms.

Parameters:
  • structure (Structure) – Input Structure.

  • strip_3prime (bool) – If True, also remove O3P and OP3 from 3’ termini.

  • chain (Optional[str]) – Optional chain ID to restrict processing to.

Returns:

None. The input structure is modified in-place.

neurosnap.structure.filters.remove_atoms(structure, predicate, *, chain=None)[source]#

Remove atoms from a structure in-place when they match a predicate.

Parameters:
  • structure (Structure) – Input Structure.

  • predicate (Callable) – Callable that accepts an atom view and returns True when that atom should be removed.

  • chain (Optional[str]) – Optional chain ID to restrict atom removal to.

Returns:

None. The input structure is modified in-place.

neurosnap.structure.filters.remove_chains(structure, predicate)[source]#

Remove chains from a structure in-place when they match a predicate.

Parameters:
  • structure (Structure) – Input Structure.

  • predicate (Callable) – Callable that accepts a chain view and returns True when that chain should be removed.

Returns:

None. The input structure is modified in-place.

neurosnap.structure.filters.remove_non_biopolymers(structure, *, chain=None)[source]#

Remove non-biopolymer residues from a structure in-place.

Parameters:
  • structure (Structure) – Input Structure.

  • chain (Optional[str]) – Optional chain ID to restrict residue removal to.

Returns:

None. The input structure is modified in-place.

Notes

Residues are preserved when they classify as valid protein or nucleotide polymer components, even if they were parsed as hetero atoms. Ambiguous placeholders such as ASX, GLX, XLE, and UNK are removed. Common protonation or tautomer states such as HID and HIE are preserved.

neurosnap.structure.filters.remove_nucleotides(structure, *, chain=None)[source]#

Remove DNA and RNA residues from a structure in-place.

Parameters:
  • structure (Structure) – Input Structure.

  • chain (Optional[str]) – Optional chain ID to restrict residue removal to.

Returns:

None. The input structure is modified in-place.

neurosnap.structure.filters.remove_residues(structure, predicate, *, chain)[source]#

Remove residues from a structure in-place when they match a predicate.

Parameters:
  • structure (Structure) – Input Structure.

  • predicate (Callable) – Callable that accepts a residue view and returns True when that residue should be removed.

  • chain (Optional[str]) – Optional chain ID to restrict residue removal to.

Returns:

None. The input structure is modified in-place.

neurosnap.structure.filters.remove_waters(structure, *, chain=None)[source]#

Remove water residues from a structure in-place.

Parameters:
  • structure (Structure) – Input Structure.

  • chain (Optional[str]) – Optional chain ID to restrict residue removal to.

Returns:

None. The input structure is modified in-place.