4IMP.bff can to search for an optimal path on a grid with obstacles
5between two points using established algorithms (e.g., Dijkstra and
6A star). These path search algorithms can be used to implement accessible
7volume calculations of label for fluorescence or EPR experiments in a
81:N (one starting node N end nodes) path search (Dijkstra) or for 1:1
9(one start node one end node) path searches (Astar), e.g., for
10implementing cross-linking restraints.
35sel.set_residue_index(132)
37sel_particles = sel.get_selected_particles()
39path_origin = labeled_p.get_coordinates()
50path_map_header.set_path_origin(path_origin)
59path_map.set_particles(ps)
60path_map.sample_obstacles(extra_radius=0.0)
69start_idx = path_map.get_voxel_by_location(path_origin)
71r_end = path_map.get_location_by_voxel(end_idx)
72r_start = path_map.get_location_by_voxel(start_idx)
83path_map.find_path_dijkstra(start_idx, end_idx)
92tiles = path_map.get_tiles()
93path_dijkstra = tiles[end_idx].backtrack_to_path()
95path_map.find_path_astar(start_idx, end_idx)
96path_astar = path_map.get_tiles()[end_idx].backtrack_to_path()
107def get_distances(path):
108 locations = [path_map.get_location_by_voxel(i)
for i
in path]
111 return distances_start, distances_end
113dsd, ded = get_distances(path_dijkstra)
114dsa, dea = get_distances(path_astar)
115fig, axs = plt.subplots(1, 2, sharex=
True)
116axs[0].set(xlabel=
'step', ylabel=
'Distance from end')
117axs[0].plot(ded, label=
"Dijkstra")
118axs[0].plot(dea, label=
"Astar")
119axs[1].set(xlabel=
'step', ylabel=
'Cummulative path length')
120axs[1].plot(np.cumsum(dsd), label=
"Dijkstra")
121axs[1].plot(np.cumsum(dsa), label=
"Astar")
122axs[1].set_title(
'A-star')
125plt.savefig(
'plot.png')
Class for storing model, its restraints, constraints, and particles.
Select hierarchy particles identified by the biological name.
Class to search path on grids.
A decorator for a particle with x,y,z coordinates.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
double get_distance(const Line3D &s, const Vector3D &p)
Get closest distance between a line and a point.
Functionality for loading, creating, manipulating and scoring atomic structures.
Hierarchy read_pdb(TextInput input, Model *model, PDBSelector *selector=get_default_pdb_selector(), bool select_first_model=true)
Read all the molecules in the first model of the PDB file.
Hierarchies get_leaves(const Selection &h)
Bayesian Fluorescence Framework.
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.
Basic functionality that is expected to be used by a wide variety of IMP users.
Basic utilities for handling cryo-electron microscopy 3D density maps.