Skip to content

Commit f68af2c

Browse files
committed
remove commented code
1 parent da05916 commit f68af2c

File tree

1 file changed

+0
-132
lines changed

1 file changed

+0
-132
lines changed

pymgpipe/fva.py

-132
Original file line numberDiff line numberDiff line change
@@ -243,138 +243,6 @@ def _optlang_worker(threshold, metabolites):
243243
result.append({"id": m, "min": min_sol, "max": max_sol})
244244
return result
245245

246-
247-
# def veryFastFVA(
248-
# nCores,
249-
# nThreads,
250-
# path,
251-
# model=None,
252-
# ex_only=True,
253-
# scaling=0,
254-
# memAff="none",
255-
# schedule="dynamic",
256-
# nChunk=50,
257-
# optPerc=90,
258-
# reactions=None,
259-
# regex=None,
260-
# threshold=1e-5,
261-
# ):
262-
# """
263-
# VFFVA performs Very Fast Flux Variability Analysis (VFFVA). VFFVA is a parallel implementation of FVA that
264-
# allows dynamically assigning reactions to each worker depending on their computational load
265-
# Guebila, Marouen Ben. "Dynamic load balancing enables large-scale flux variability analysis." bioRxiv (2018): 440701.
266-
267-
# USAGE:
268-
# minFlux,maxFlux=VFFVA(nCores, nThreads, model, scaling, memAff, schedule, nChunk, optPerc, ex)
269-
270-
# :param nCores: Number of non-shared memory cores/machines.
271-
# :param nThreads: Number of shared memory threads in each core/machine.
272-
# :param model: .mps format: path to metabolic model in .mps format.
273-
# :param scaling: CPLEX parameter. It corresponds to SCAIND parameter (Default = 0).
274-
# -1: no scaling; 0: equilibration scaling; 1: more aggressive scaling.
275-
# more information here: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.7.0/ilog.odms.cplex.help/CPLEX/Parameters/topics/ScaInd.html.
276-
# :param memAff: 'none', 'core', or 'socket'. (Default = 'none'). This an OpenMPI parameter, more
277-
# information here: https://www.open-mpi.org/faq/?category=tuning#using-paffinity-v1.4.
278-
# :param schedule: 'dynamic', 'static', or 'guided'. (Default = 'dynamic'). This is an OpenMP parameter, more
279-
# information here: https://software.intel.com/en-us/articles/openmp-loop-scheduling
280-
# :param nChunk: Number of reactions in each chunk (Default = 50). This is an OpenMP parameter, more
281-
# information here: https://software.intel.com/en-us/articles/openmp-loop-scheduling
282-
# :param optPerc: Percentage of the optimal objective used in FVA. Integer between 0 and 100. For example, when set to 90
283-
# FVA will be computed on 90% of the optimal objective.
284-
# :param ex: 0-based indices of reactions to optimize as a numpy array. (Default, all reactions)
285-
# :return:
286-
# minFlux: (n,1) vector of minimal flux values for each reaction.
287-
# maxFlux: (n,1) vector of maximal flux values for each reaction.
288-
# """
289-
# status = os.system("mpirun --version")
290-
# if status != 0:
291-
# raise ValueError(
292-
# [
293-
# "MPI and/or CPLEX nont installed, please follow the install guide"
294-
# "or use the quick install script"
295-
# ]
296-
# )
297-
298-
# # Set schedule and chunk size parameters
299-
# os.environ["OMP_SCHEDUELE"] = schedule + str(nChunk)
300-
301-
# model = load_model(path if model is None else model)
302-
# with suppress_stdout():
303-
# model.optimize()
304-
# if model.status == "infeasible":
305-
# raise Exception("%s model is infeasible!" % model.name)
306-
# return
307-
308-
# var_dict = {i: v.name for i, v in enumerate(model.variables)}
309-
# var_dict_inv = {v: k for k, v in var_dict.items()}
310-
311-
# ex_indices = [
312-
# var_dict_inv[r.name]
313-
# for r in get_reactions(
314-
# model,
315-
# reactions=reactions,
316-
# regex=Constants.EX_REGEX if ex_only and regex is None else regex,
317-
# )
318-
# ]
319-
# print("Running on %s reactions!" % len(ex_indices))
320-
321-
# # Set reactions to optimize
322-
# rxns_file = "rxns_%s.txt" % model.name
323-
# with open(rxns_file, "w") as f:
324-
# for num in ex_indices:
325-
# f.write(str(num) + "\n")
326-
327-
# assert (
328-
# vffva_config.path is not None
329-
# ), "Please set value of `vffva_config.path` to location of VFFVA executable"
330-
# try:
331-
# status = os.system(
332-
# "mpirun -np "
333-
# + str(nCores)
334-
# + " --bind-to "
335-
# + str(memAff)
336-
# + " -x OMP_NUM_THREADS="
337-
# + str(nThreads)
338-
# + f" {vffva_config.path}/lib/veryfastFVA "
339-
# + path
340-
# + " "
341-
# + str(optPerc)
342-
# + " "
343-
# + str(scaling)
344-
# + " "
345-
# + rxns_file
346-
# )
347-
# except:
348-
# raise Exception(
349-
# "Ran into issue when submitting VFFVA mpirun, please check installation- %s"
350-
# % status
351-
# )
352-
353-
# # Fetch results
354-
# resultFile = path[:-4] + "output.csv"
355-
# if not os.path.exists(resultFile):
356-
# raise Exception(
357-
# "Ran into issue when running VFFVA, could not find results file..."
358-
# )
359-
# results = pd.read_csv(resultFile, header=0)
360-
361-
# os.system("rm " + resultFile)
362-
# os.system("rm " + rxns_file)
363-
# results.rename(
364-
# {i: var_dict[x] for i, x in enumerate(ex_indices) if i in results.index},
365-
# axis=0,
366-
# inplace=True,
367-
# )
368-
369-
# results.index.rename("id", inplace=True)
370-
# if threshold is not None:
371-
# results[abs(results) < threshold] = 0
372-
373-
# results.sort_index(inplace=True)
374-
# results.columns = ["min", "max"]
375-
# return results
376-
377-
378246
def _pool_init(sample_model):
379247
sys.stdout = open(os.devnull, "w")
380248

0 commit comments

Comments
 (0)