Paths
paths.GetPaths(corr_matrix, srcs, snks, context, residue_keys)
¶
Get the paths from a list of sources to a list of sinks
Identify paths that link the source and the sink and order them by their lengths.
PARAMETER | DESCRIPTION |
---|---|
corr_matrix
|
a np.array, the calculated correlation matrix
TYPE:
|
srcs
|
a list of ints, the indices of the sources for path finding
TYPE:
|
snks
|
a list of ints, the indices of the sinks for path finding
TYPE:
|
context
|
the user-specified command-line parameters, a UserInput object
TYPE:
|
residue_keys
|
a list containing string representations of each residue
TYPE:
|
paths = pths
instance-attribute
¶
paths_description = f'{self.paths_description} Nodes: ' + ' - '.join([residue_keys[item] for item in path[1:]]) + '\n'
instance-attribute
¶
get_length_of_path(path, corr_matrix)
¶
Calculate the length of a path
PARAMETER | DESCRIPTION |
---|---|
path
|
a list of ints, the indices of the path
|
corr_matrix
|
a np.array, the calculated correlation matrix
|
RETURNS | DESCRIPTION |
---|---|
a float, the length of the path |
get_paths_between_multiple_endpoints(cutoff, corr_matrix, srcs, snks, G, context)
¶
Get paths between sinks and sources
PARAMETER | DESCRIPTION |
---|---|
cutoff
|
a np.array containing a single float, the cutoffspecifying the maximum permissible path length
|
corr_matrix
|
a np.array, the calculated correlation matrix
|
srcs
|
a list of ints, the indices of the sources for path finding
|
snks
|
a list of ints, the indices of the sinks for path finding
|
G
|
a nx.Graph object describing the connectivity of the different nodes
|
context
|
the user-specified command-line parameters, a UserInput object
|
RETURNS | DESCRIPTION |
---|---|
a list of paths, where each path is represented by a list. The first item in each path is the length |
|
of the path (float). The remaining items are the indices of the nodes in the path (int). |
get_paths_fixed_endpoints(cutoff, corr_matrix, source, sink, G, context)
¶
Get paths between a single sink and a single source
PARAMETER | DESCRIPTION |
---|---|
cutoff
|
a np.array containing a single float, the cutoff specifying the maximum permissible path length
|
corr_matrix
|
a np.array, the calculated correlation matrix
|
source
|
the index of the source for path finding
|
sink
|
the index of the sink for path finding
|
G
|
a nx.Graph object describing the connectivity of the different nodes
|
context
|
the user-specified command-line parameters, a UserInput object
|
RETURNS | DESCRIPTION |
---|---|
a list of paths, where each path is represented by a list. The first item |
|
in each path is the length of the path (float). The remaining items are |
|
the indices of the nodes in the path (int). |
get_shortest_path_length(corr_matrix, srcs, snks, G)
¶
Identify the length of the shortest path connecting any of the sources and any of the sinks
PARAMETER | DESCRIPTION |
---|---|
corr_matrix
|
a np.array, the calculated correlation matrix
|
srcs
|
a list of ints, the indices of the sources for path finding
|
snks
|
a list of ints, the indices of the sinks for path finding
|
G
|
a nx.Graph object describing the connectivity of the different nodes
|
RETURNS | DESCRIPTION |
---|---|
a float, the length of the shortest path, and a list of ints corresponding |
|
to the nodes of the shortest path. |
remove_redundant_paths(pths)
¶
Removes redundant paths
PARAMETER | DESCRIPTION |
---|---|
pths
|
a list of paths
|
RETURNS | DESCRIPTION |
---|---|
A list of paths with the redundant ones eliminated. |
paths.find_paths
¶
Path-finding data processing on a single processor
results = []
class-attribute
instance-attribute
¶
expand_growing_paths_one_step(paths_growing_out_from_source, full_paths_from_start_to_sink, cutoff, sink, G)
¶
Expand the paths growing out from the source to the sink by one step (to the neighbors of the terminal node) of the expanding paths
PARAMETER | DESCRIPTION |
---|---|
paths_growing_out_from_source
|
a list of paths, where each path is represented by a list. The first item in each path is the length of the path (float). The remaining items are the indices of the nodes in the path (int).
|
full_paths_from_start_to_sink
|
a growing list of identified paths that connect the source and the sink, where each path is formatted as above.
|
cutoff
|
a numpy array containing a single element (float), the length cutoff. Paths with lengths greater than the cutoff will be ignored.
|
sink
|
the index of the sink (int)
|
G
|
a nx.Graph object describing the connectivity of the different nodes
|
runit(running, mutex, results_queue, items)
¶
Path-finding data processing on a single processor.
PARAMETER | DESCRIPTION |
---|---|
running
|
a mp.Value() object
|
mutex
|
a mp.Lock() object
|
results_queue
|
where the results will be stored [mp.Queue()]
|
items
|
the data to be processed, in a list
|
value_func(item, results_queue)
¶
Process a single path-finding "branch"
PARAMETER | DESCRIPTION |
---|---|
item
|
a tuple containing required information. The first is a numpy array containing a single float, the path-length cutoff The second is an index corresponding to the ultimate path sink The third is a nx.Graph object describing the connectivity of the different nodes The fourth is a list corresponding to a path. The first item is the length of the path (float). The remaining items are the indices of the nodes in the path (int).
|
results_queue
|
where the results will be stored [mp.Queue()]
|
paths.multi_threading_find_paths(inputs, num_processors=None)
¶
Launches path finding on multiple processors
PARAMETER | DESCRIPTION |
---|---|
inputs
|
the data to be processed, in a list
TYPE:
|
num_processors
|
the number of processors to use to process this data.
TYPE:
|