ShortestPath module

Submodules

ShortestPath.constraints

class ShortestPath.constraints.ConstructInitialLP(allrxns, allcpds, db, ignorerxns, includerxns, forward_direction=True, reverse_direction=False, lp=None, variables=None, allrxnsrev_dict_rev=None, allrxnsrev_dict=None, allrxnsrev=None)

Bases: object

Constructs A matrix and indidvidual reaction constraints

initial_A_matrix(solver=False)

Generates an matrix of compound constraints

initial_reaction_constraints()

Sets up column (individual reaction) constraints

load_pulp_row_constraints(pulp)

Loads constraints in to pulp integer linear problem

load_reaction_variables(rxn_rev, rxn, rxn_id)
reaction_constraints_ignore_reactions()
reaction_constraints_include_reactions()
reaction_constraints_pulp(variable_name, rxn_name, pulp)

Set reaction constraints (pulp)

retrieve_stoichiometry(met)

Retrieve stoichometry for each compound

ShortestPath.constraints.load_stoichometry_for_met(reactantrxns, productsrxns, allrxnsrev, allrxnsrev_index, allrxnsrevset)

Gets stoichometry for all compounds to be in the A matrix

ShortestPath.extractinfo

class ShortestPath.extractinfo.Extract_Information(optimal_pathways, incpds, inrxns, db)

Bases: object

Retrieves names of compounds, reactions and organisms for reactions and compounds that need to be added to produce a target compound

extractinfo(path)

Builds necessary dictionaries to hold the info found in the get_info function

get_info(rxn, path_dict, excpds, Direction=False)

Gets information for reactions, compounds and organisms

ShortestPath.integerprogram_pulp

class ShortestPath.integerprogram_pulp.IntergerProgram(db, limit_reactions, limit_cycle, k_paths, cycle, verbose, time_limit, OUTPUT)

Bases: object

Sets final constraints and solved integer linear program

cycle_constraints(lp, variables, solution, solution_internal, obj, cycle_count, initialcheck=False)

Check solution for cycles and implement new constraints and resolve if cycle is identified

cycle_constraints_internal(lp, variables, solution, obj, cycle_count, length_external)

Check solution for cycles and implement new constraints and resolve if cycle is identified

fill_allsolutions(solution)
filling_optimal_solution_arrays(solution, solution_internal, op, op_internal)
identify_internal_rxns(variables, op, op_internal, lp)
initiate_cycle_check(solution, solution_internal, lp, variables, obj, cycle_check_count, initialcheck_value=False)
initiate_internal_cycle_check(solution, lp, variables, obj, cycle_check_count, length_external)
initiate_multiple_solutions(solution, lp, variables, obj, op, op_internal, count_k_paths)
ip_calculate(lp, variables, obj)

Run glpk solver

k_number_paths(lp, variables, obj, op, op_internal, count_k_paths)

‘retrieve the next shortest path

multiple_optimal_solution(lp, variables, obj, originalsolution, op, op_internal, count_k_paths)

Identify multiple solutions

multiple_optimal_solution_internal(lp, variables, obj, originalsolution, op)

Find multiple solutions that use organisms internal reactions

run_cycle_check(solution)

Run cycle check

run_glpk(LP, incpds, inrxns, target_compound_ID, multiplesolutions=True)

Final set up and solve integer linear program

set_lp_problem(lp, variables)
set_objective_function(variables)

Set objective function

set_objective_function_internal(variables)

Set objective function

set_row_bounds(lp)

Set row bounds

set_weight(number_rxn_steps)

retrieve weight to disfavor rxns in path

ShortestPath.integerprogram_pulp.verbose_print(verbose, line)