dexom_python.enum_functions package

Submodules

dexom_python.enum_functions.diversity_enum module

dexom_python.enum_functions.diversity_enum.diversity_enum(model, reaction_weights, prev_sol, eps=0.001, thr=1e-05, obj_tol=0.001, maxiter=10, dist_anneal=0.995, out_path='enum_dexom', icut=True, full=False, save=False)[source]

diversity-based enumeration

Parameters
  • model (cobrapy Model) –

  • reaction_weights (dict) – keys = reactions and values = weights

  • prev_sol (Solution instance) – a previous imat solution

  • threshold (float) – detection threshold of activated reactions

  • obj_tol (float) – variance allowed in the objective_values of the solutions

  • maxiter (foat) – maximum number of solutions to search for

  • dist_anneal (float) – parameter which influences the probability of selecting reactions

  • out_path (str) – path to which the results are saved

  • icut (bool) – if True, icut constraints are applied

  • full (bool) – if True, the full-DEXOM implementation is used

  • save (bool) – if True, every individual solution is saved in the iMAT solution format

Returns

solution

Return type

an EnumSolution object

dexom_python.enum_functions.enumeration module

class dexom_python.enum_functions.enumeration.EnumSolution(solutions, binary, objective_value)[source]

Bases: object

class for solutions of enumeration methods

Parameters
  • solutions (pandas dataframe containing flux values with reaction ids as index) –

  • binary (list containing reaction activity (0 for inactive, 1 for active)) –

  • objective_value (objective value returned by the solver at the end of the optimization) –

dexom_python.enum_functions.enumeration.analyze_div_enum_results(result_path, solution_path, out_path)[source]

This function calculates the average pairwise hamming distance and average next neighbour distance for each iteration - it’s very slow

Parameters
  • result_path (csv results file from diversity-enum) –

  • solution_path (csv solution file from diversity-enum) –

  • out_path (path for saving) –

dexom_python.enum_functions.enumeration.get_recent_solution_and_iteration(dirpath, startsol_num)[source]
dexom_python.enum_functions.enumeration.write_batch_script1(directory, username, modelfile, weightfile, reactionlist, imatsol, objtol, filenums=100, iters=100)[source]
dexom_python.enum_functions.enumeration.write_batch_script2(filenums)[source]

Warning: this function has not been updated with recent changes to DEXOM

dexom_python.enum_functions.enumeration.write_batch_script_divenum(directory, username, modelfile, weightfile, rxnsols, objtol, eps=0.0001, thr=1e-05, tol=1e-08, filenums=100, iters=100, t=6000)[source]
dexom_python.enum_functions.enumeration.write_rxn_enum_script(directory, modelfile, weightfile, reactionlist, imatsol, username, eps=0.0001, thr=1e-05, tol=1e-08, iters=100, maxiters=10000000000.0)[source]

dexom_python.enum_functions.icut module

dexom_python.enum_functions.icut.create_icut_constraint(model, reaction_weights, threshold, prev_sol, name, full=False)[source]

Creates an icut constraint on the previously found solution. This solution is excluded from the solution space.

dexom_python.enum_functions.icut.icut(model, prev_sol=None, reaction_weights=None, eps=0.01, thr=1e-05, obj_tol=0.001, maxiter=10, full=False)[source]

integer-cut method

Parameters
  • model (cobrapy Model) –

  • prev_sol (imat Solution object) – an imat solution used as a starting point

  • reaction_weights (dict) – keys = reactions and values = weights

  • eps (float) – activation threshold in imat

  • thr (float) – detection threshold of activated reactions

  • tlim (int) – time limit for imat

  • tol (float) – tolerance for imat

  • obj_tol (float) – variance allowed in the objective_values of the solutions

  • maxiter (foat) – maximum number of solutions to check for

  • full (bool) – if True, carries out integer-cut on all reactions; if False, only on reactions with non-zero weights

Returns

solution – In the case of integer-cut, all_solutions and unique_solutions are identical

Return type

EnumSolution object

dexom_python.enum_functions.maxdist module

dexom_python.enum_functions.maxdist.create_maxdist_constraint(model, reaction_weights, prev_sol, obj_tol, name='maxdist_optimality', full=False)[source]

Creates the optimality constraint for the maxdist algorithm. This constraint conserves the optimal objective value of the previous solution

dexom_python.enum_functions.maxdist.create_maxdist_objective(model, reaction_weights, prev_sol, prev_sol_bin, only_ones=False, full=False)[source]

Create the new objective for the maxdist algorithm. This objective is the minimization of similarity between the binary solution vectors If only_ones is set to False, the similarity will only be calculated with overlapping ones

dexom_python.enum_functions.maxdist.maxdist(model, reaction_weights, prev_sol, threshold=0.0001, obj_tol=0.01, maxiter=10, out_path='maxdist', icut=True, full=False, only_ones=False)[source]

maximal distance enumeration

Parameters
  • model (cobrapy Model) –

  • reaction_weights (dict) – keys are reactions and values are weights

  • prev_sol (Solution object) – a previously computed imat solution

  • threshold (float) – detection threshold of activated reactions

  • obj_tol (float) – variance allowed in the objective_values of the solutions

  • maxiter (foat) – maximum number of solutions to check for

  • only_ones (bool) – determines if the hamming distance is only calculated with ones, or with ones & zeros

dexom_python.enum_functions.rxn_enum module

class dexom_python.enum_functions.rxn_enum.RxnEnumSolution(all_solutions, unique_solutions, all_binary, unique_binary, all_reactions=None, unique_reactions=None)[source]

Bases: object

dexom_python.enum_functions.rxn_enum.rxn_enum(model, reaction_weights, rxn_list, prev_sol, eps=1.0, thr=0.1, obj_tol=0.01)[source]

Reaction enumeration method

Parameters
  • model (cobrapy Model) –

  • reaction_weights (dict) – keys = reactions and values = weights

  • eps (float) – activation threshold in imat

  • thr (float) – detection threshold of activated reactions

  • tlim (int) – time limit for imat

  • tol (float) – tolerance for imat

  • obj_tol (float) – variance allowed in the objective_values of the solutions

  • out_name (str) – name of output files without format

Returns

solution

Return type

RxnEnumSolution object

dexom_python.enum_functions.rxn_enum.rxn_enum_single_loop(model, reaction_weights, rec_id, new_rec_state, out_name, eps=0.01, thr=1e-05)[source]

Module contents