neurosnap.structure.analysis module#
General analysis helpers & physical property calculations for Neurosnap structures.
- neurosnap.structure.analysis.ca_distance_matrix(structure, chain=None)[source]#
Alias for
calculate_distance_matrix().
- neurosnap.structure.analysis.calculate_distance_matrix(structure, chain=None)[source]#
Calculate the CA-atom distance matrix for a single structure.
- neurosnap.structure.analysis.calculate_protein_volume(structure, chain=None)[source]#
Estimate protein volume from atom van der Waals spheres.
The calculation sums the volumes of van der Waals spheres for atoms belonging to residues classified as protein. It is therefore a simple geometric estimate rather than an excluded-volume or solvent-corrected measurement.
- neurosnap.structure.analysis.calculate_surface_area(structure, level='R', probe_radius=1.4, n_sphere_points=96)[source]#
Estimate solvent-accessible surface area using a simple Shrake-Rupley approximation.
The returned total SASA is the same regardless of
level; the parameter is kept for compatibility with the public surface-area API.- Parameters:
structure (
Structure) – Input single-modelStructure.level (
str) – Compatibility flag matching the historical public API. The returned total SASA is always a structure-level scalar, regardless of this value. Must be one of"A","R","C","M", or"S".probe_radius (
float) – Solvent probe radius in Å used to inflate atom radii during the accessibility calculation.n_sphere_points (
int) – Number of surface points sampled per atom for the Shrake-Rupley approximation.
- Return type:
- Returns:
Estimated solvent-accessible surface area in Ų.
- neurosnap.structure.analysis.extract_non_biopolymers(structure, output_dir, min_atoms=0)[source]#
Extract non-biopolymer fragments from a structure and write them as SDF files.
Biopolymer residues are removed using the same residue-name logic as the old implementation: any residue present in
AA_RECORDSorSTANDARD_NUCLEOTIDESis treated as part of a protein or nucleotide polymer, exceptUNKwhich is preserved. The remaining atoms are written to a temporary PDB, read into RDKit, split into disconnected fragments, and then exported as individual SDF files.- Parameters:
- Returns:
None. Matching fragments are written tooutput_diras.sdffiles.
- neurosnap.structure.analysis.get_backbone(structure, chains=None, *, include_nucleotides=True)[source]#
Extract ordered backbone coordinates from a single structure.
Protein residues contribute
N,CA, andCatoms. Wheninclude_nucleotidesis enabled, DNA and RNA residues contribute their sugar-phosphate backbone atoms in a deterministic order. Non-polymers are ignored.- Parameters:
- Return type:
- Returns:
A NumPy array of backbone coordinates with shape
(n_atoms, 3).