Skip to content

Commit c779061

Browse files
committed
cleanup
1 parent cfff0f7 commit c779061

File tree

3 files changed

+6
-36
lines changed

3 files changed

+6
-36
lines changed

merrin/LPModel.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from pulp import (
99
COIN_CMD,
10+
PULP_CBC_CMD,
1011
LpStatus,
1112
LpMaximize,
1213
LpProblem,
@@ -17,6 +18,8 @@
1718

1819
#AUXILIARY#FUNCTIONS##MODELS####################################################
1920

21+
LP_SOLVER = COIN_CMD if COIN_CMD().available() else PULP_CBC_CMD
22+
2023

2124
def get_base_fba_lp_model(time, internal_metabolites, reactions, bounds, stoichiometry, obj, removeObj=False):
2225
# ------------------------------------------------------------------------ #
@@ -113,7 +116,7 @@ def add_maximised_forced_state(fba, f, reactions, reactions_states, bounds, epsi
113116

114117
def solve_rfba(fba_lp_model, lp_variables, obj_reaction):
115118
# Coin Branch and Cut solver is used to solve the instanced model
116-
solver = COIN_CMD(msg=0, timeLimit=5)
119+
solver = LP_SOLVER(msg=0, timeLimit=5)
117120

118121
fba_lp_model.solve(solver)
119122

@@ -131,7 +134,7 @@ def solve_rfba(fba_lp_model, lp_variables, obj_reaction):
131134

132135
def solve_lp_model(lp_model, lp_variables):
133136
# Coin Branch and Cut solver is used to solve the instanced model
134-
solver = COIN_CMD(msg=0)
137+
solver = LP_SOLVER(msg=0)
135138

136139
lp_model.solve(solver)
137140

merrin/Loader.py

-34
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
1-
#! /usr/bin/env python3
2-
# -*- coding: utf-8 -*-
3-
__author__ = "Kerian Thuillier"
4-
__email__ = "[email protected]"
5-
6-
#IMPORT#########################################################################
7-
81
import bonesis
92
import pandas as pd
103
import networkx as nx
114
from libsbml import SBMLReader
125
from .Parameters import DATA_TYPE_COLUMN
136
from .MetabolicNetworks import MetabolicNetwork
147

15-
#CODE###########################################################################
16-
17-
188
def load_sbml(sbml_file: str):
19-
"""
20-
Function:
21-
Params:
22-
Return:
23-
"""
249
sbmld = SBMLReader().readSBML(sbml_file)
2510
sbmlm = sbmld.getModel()
2611

@@ -31,12 +16,6 @@ def load_sbml(sbml_file: str):
3116

3217

3318
def load_pkn(pkn_file: str, inputs):
34-
"""
35-
Function:
36-
Params:
37-
Return:
38-
"""
39-
4019
pkn = nx.DiGraph()
4120
with open(pkn_file) as fp:
4221
for line in fp:
@@ -93,16 +72,3 @@ def load_simulations(files_path: str, k: int = 0, tag: str = None) -> pd.DataFra
9372
sim[DATA_TYPE_COLUMN] = tag
9473

9574
return simulations
96-
97-
98-
def main():
99-
"""
100-
Function: main function executing the project
101-
Params: None
102-
Return: None
103-
"""
104-
105-
106-
#RUN############################################################################
107-
if __name__ == '__main__':
108-
main()

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
author = "Kerian Thuillier",
88
author_email = "[email protected]",
99
install_requires = [
10+
"bonesis",
1011
"clingo",
1112
"ginsim",
1213
"pandas",

0 commit comments

Comments
 (0)