geometry¶
- faltwerk.geometry.distance_to_closest_active_site(fold, binding_frequencies, threshold=0.5)[source]¶
Calculate the (Euclidean) distance of each residue to the closest active site (or really any annotation, for that matter).
Usage:
>>> m = Fold('serine_hydroxymethyltransferase.pdb') >>> b = Binding(m, 'confident') >>> b.predict_binding_(hmms) >>> bf = b.get_binding('PF00464.18', 'SER') >>> distance_to_closest_active_site(m, bf, .5)
Optional arguments:
threshold – cut-off what counts as binding site (default 0.5)
- faltwerk.geometry.distance_to_positions(model, positions)[source]¶
Sometimes it is useful to analyse the distance of residues to some feature such as a binding interface.
See eg:
https://www.biorxiv.org/content/10.1101/2022.03.02.482602v1.full.pdf
Usage:
>>> import altair as alt >>> from faltwerk import Complex >>> from faltwerk.geometry import get_complex_interface, distance_to_positions >>> cx = Complex('/path/to/model.pdb') >>> interface = get_complex_interface(cx, 10) >>> distance_to_interface = distance_to_positions(model, interface)
>>> # Create a dataframe with residue numbers and whether the sites are >>> # under positive selection or not. >>> df['distance_to_interface'] = distance_to_interface
>>> alt.Chart(df).mark_boxplot(extent=1.5).encode( >>> x='selection:O', >>> y='distance_to_interface:Q', >>> )
- faltwerk.geometry.euclidean_distance(a, b)[source]¶
Calculate the Euclidean disance between two points.
https://stackoverflow.com/questions/1401712/how-can-the-euclidean-distance-be-calculated-with-numpy
- faltwerk.geometry.get_alpha_carbon_atoms(x: Union[Atom, Residue], only_coords=False)[source]¶
Given a (Biopython) Atom or Residue object, return a generator of backbone carbon atoms.
- faltwerk.geometry.get_complex_interface(chains: List, angstrom=10, map_to_chains=False)[source]¶
Given a Complex object, ie a protein structure complex, return all binding interfaces.
Usage:
>>> from faltwerk import Complex >>> from foldspace.geometry import get_complex_interface >>> cx = Complex('/path/to/model.pdb') >>> interface = get_complex_interface(cx, 10)
Optional arguments:
map_to_chains – remember which interface atom belongs to which chain(s) (default True)
- faltwerk.geometry.get_coordinate(x: Union[Atom, Residue])[source]¶
Calculate the center of mass for an atom or residue. Note: Calculating the center of mass is much slower than looking up the coordinate of a carbon atom.
- faltwerk.geometry.get_foldseek_vae_states(fold)[source]¶
foldseekis a program to search similar protein structures. Methodically it is really clever as it maps each residue to a latent state that represents local geometry, and then searches homologous proteins based on this VAE alphabet.This function is for exploration only, maybe those states can be useful when training neural nets.
- faltwerk.geometry.get_foldseek_vae_states_from_path(fp)[source]¶
Same as
get_foldseek_vae_statesbut from path.
- faltwerk.geometry.get_interface(A: Chain, B: Chain, angstrom=10)[source]¶
Get all residue positions that are likely binding partners btw/ 2 chains.
Usage:
>>> get_interface(cx.chains['B'], cx.chains['D'])
Optional arguments:
angstrom – maximum distance of what counts as interface (default 10)
- faltwerk.geometry.is_close(pos, fold, radius, coordinates='alpha_carbons')[source]¶
Find all neighbors within a specified distance of a residue.
Usage:
>>> m = Fold('test.pdb') >>> list(is_close(1, fold, 10)) >>> # [True, True, True, True, True, False, False, ...]
Optional arguments:
radius – Angstrom radius around residue of interest
coordinates – “center_of_mass” or “alpha_carbon” (default)