From d393c999e8c3b44ff831a53b21cf22ce8be78c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20H=C3=A9risson?= Date: Tue, 21 Nov 2023 14:56:00 +0100 Subject: [PATCH] chore(rplibs): fit to dep ver --- rptools/rplibs/rpSBML.py | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/rptools/rplibs/rpSBML.py b/rptools/rplibs/rpSBML.py index 3cbe407..9064737 100644 --- a/rptools/rplibs/rpSBML.py +++ b/rptools/rplibs/rpSBML.py @@ -5,8 +5,11 @@ from copy import deepcopy from filetype import guess from hashlib import sha256 -from math import isnan -from pandas import DataFrame as pd_DataFrame +#from math import isnan +from pandas import ( + DataFrame as pd_DataFrame, + concat as pd_concat +) from os import ( path as os_path, @@ -14,13 +17,13 @@ ) from json import ( load as json_load, - dump as json_dump, +# dump as json_dump, dumps as json_dumps ) -from inspect import ( - getmembers as inspect_getmembers, - ismethod as inspect_ismethod -) +# from inspect import ( +# getmembers as inspect_getmembers, +# ismethod as inspect_ismethod +# ) from logging import ( Logger, getLogger @@ -30,12 +33,12 @@ Dict, Tuple, TypeVar, - Union +# Union ) from tempfile import ( NamedTemporaryFile, TemporaryDirectory, - gettempdir, +# gettempdir, ) import cobra from cobra import ( @@ -2492,14 +2495,18 @@ def _specie_id_from_exchange( # Create list of exchange reactions for reaction in model.getModel().getListOfReactions(): if model.is_boundary_type(reaction, "exchange", compartment_id): - compound = dict( - model_id=_specie_id_from_exchange( - reaction, - logger + compound = pd_DataFrame( + dict( + model_id=_specie_id_from_exchange( + reaction, + logger + ), + libsbml_reaction=reaction ), - libsbml_reaction=reaction + index=[0] ) - df = df.append(compound, ignore_index=True) +# df = df.append(compound, ignore_index=True) + df = pd_concat([df, compound], ignore_index=True) # Fmg df.sort_values('model_id', inplace=True) df.reset_index(inplace=True, drop=True)