WatCon.find_conserved_networks module
Cluster water coordinates and analyze conservation to clustered networks
- WatCon.find_conserved_networks.cluster_coordinates_only(coordinate_list, cluster='hdbscan', min_samples=10, eps=0.0, n_jobs=1)[source]
Cluster a set of coordinates.
- Parameters:
coordinate_list (list of array-like) – A combined list of all coordinates to be clustered.
cluster (str) – Clustering method, can be ‘optics’, ‘dbscan’, or ‘hdbscan’.
min_samples (int) – Minimum number of samples required for a cluster.
- Returns:
Cluster labels (array-like)
Cluster centers (dict)
- Return type:
tuple
- WatCon.find_conserved_networks.cluster_nodes(combined_graph, cluster='hdbscan', min_samples=10)[source]
Cluster node positions from a combined NetworkX graph.
- Parameters:
combined_graph (networkx.Graph) – A combined graph used for clustering.
cluster (str) – Clustering method, can be ‘optics’, ‘dbscan’, or ‘hdbscan’.
min_samples (int) – Minimum number of samples required for a cluster.
- Returns:
Cluster labels (array-like)
Cluster centers (dict)
- Return type:
tuple
- WatCon.find_conserved_networks.collect_coordinates(pkl_list)[source]
Collect coordinates into one array from .pkl files
- Parameters:
pkl_list (list) – List of pkl_files (full paths)
- Returns:
Array of combined coordinates
- Return type:
np.ndarray
- WatCon.find_conserved_networks.combine_graphs(list_of_graphs)[source]
Combine multiple NetworkX graph objects into a single graph.
- Parameters:
list_of_graphs (list of networkx.Graph) – List of NetworkX graph objects to be merged.
- Returns:
A combined graph containing all nodes and edges from input graphs.
- Return type:
networkx.Graph
- WatCon.find_conserved_networks.create_clustered_network(clusters, max_connection_distance, create_graph=True)[source]
Create a WaterNetwork object from cluster centers.
- Parameters:
clusters (array-like) – List of XYZ coordinates of cluster centers.
max_connection_distance (float) – Maximum allowed distance between two clusters to form an interaction.
create_graph (bool, optional) – Whether to create a NetworkX graph from the clustered WaterNetwork. Default is True.
- Returns:
A WaterNetwork object representing the clustered water network.
- Return type:
WaterNetwork
- WatCon.find_conserved_networks.find_clusters_from_densities(density_file, output_name=None, threshold=1.5)[source]
Find clusters from densities.
- Parameters:
density_file (str) – .dx file containing density information
output_name (str) – Base name for output
threshold (float) – Threshold for cutoff
- Returns:
Array of density hotspot coordinate locations
- Return type:
np.ndarray
- WatCon.find_conserved_networks.find_commonality(networks, centers, names, dist_cutoff=1.5, local_dens_radius=6)[source]
Find the commonality of a list of networks relative to a summary network created from clustering.
- Parameters:
networks (list of WaterNetwork) – List of WaterNetwork objects to be analyzed.
centers (array-like) – Locations of clustered centers.
names (list[str]) – List of IDs
dist_cutoff (float) – Distance cutoff for classifying conserved water
local_dens_radius (float) – Radius cutoff for calculating local water density
- Returns:
A dictionary containing calculated commonalities for each network.
- Return type:
dict
- WatCon.find_conserved_networks.get_coordinates_from_pdb(pdb_file)[source]
Returns coordinates for all “ATOM” or “HETATM” lines – useful for getting coordinates from cluster PDBS.
- Parameters:
pdb_file (str) – Full path to PDB file.
- Returns:
Array of coordinates
- Return type:
np.ndarray
- WatCon.find_conserved_networks.get_coordinates_from_topology(pdb_file, atom_selection='all')[source]
Collect coordinates from a given MDAnalysis-readable topology file
- Parameters:
pdb_file (str) – Full path to MDAnalysis-readable topology file
- Returns:
Array of coordinates
- Return type:
np.ndarray
- WatCon.find_conserved_networks.identify_clustered_angles(classification_file)[source]
Cluster two-angle calculations and count frequencies of clusters. Finds the closest point to the center of the cluster.
- Parameters:
classification_file (str) – Path to angle classification file (.csv)
- Returns:
cluster_conservation_dict – Dictionary containing, for each residue, frequency of individual clusters and water/protein atom coords corresponding (as close as possible) to each cluster
- Return type:
dict
- WatCon.find_conserved_networks.identify_conserved_water_clusters(networks, centers, dist_cutoff=1.0, filename_base='CLUSTERS')[source]
Create a dictionary of cluster conservation and generate a PDB file of clusters.
- Parameters:
networks (list of WaterNetwork) – List of WaterNetwork objects to analyze.
centers (array-like) – List of XYZ coordinates representing cluster centers.
dist_cutoff (float) – Distance cutoff to classify a water molecule as part of a cluster.
filename_base (str) – Base filename for saving projected clusters.
- Returns:
A dictionary mapping cluster centers to the count of included waters.
- Return type:
dict
- WatCon.find_conserved_networks.identify_conserved_water_interactions_clustering(networks, clusters, max_connection_distance=2.0, dist_cutoff=1.0, filename_base='CLUSTER', out_dir='cluster_pdbs')[source]
Rank water-water interactions in relation to clustering.
- Parameters:
networks (list of WaterNetwork) – List of WaterNetwork objects to be analyzed.
centers (array-like) – List of XYZ coordinates of cluster centers.
max_connection_distance (float) – Maximum allowed distance between two clusters to form an interaction.
dist_cutoff (float) – Distance cutoff to classify a water molecule as part of a cluster.
filename_base (str) – Base filename for saving projected clusters.
- Returns:
A dictionary mapping cluster interactions to the count of included waters.
- Return type:
dict
- WatCon.find_conserved_networks.plot_commonality(files=None, input_directory=None, cluster_pdb=None, commonality_dict=None, plot_type='bar', output='commonality', out_dir='images')[source]
Plot commonality to cluster centers.
- Parameters:
files (list) – List of outputted .pkl files from WatCon
input_directory (str) – Directory containing files
cluster_pdb (str) – PDB of clusters
commonality_dict (dict) – Commonality dict
plot_type ({‘bar’, ‘hist’}) – Type of plot
output (str) – Base filename for saving images
- Return type:
None