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-protein and non-nucleotide 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

Hetero residues are always removed by this filter, even if their residue names overlap with amino-acid or nucleotide dictionaries such as UNK.

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.