Error message when trying to run MDF analysis from TSV file
I'm using equilibrator-api version 0.2.6. When I try to create a pathway from a TSV file, using the 3 lines of code below, I get a DimensionalityError. The tsv file is the default tsv file generated by the eQuilibrator website.
from equilibrator_api import Pathway
pp = Pathway.from_sbtab('example_pathway_ethanol_fermentation_pH7.00_I0.10_MDF.tsv')
mdf_result = pp.calc_mdf()
---------------------------------------------------------------------------
DimensionalityError Traceback (most recent call last)
<ipython-input-10-3875f910cc81> in <module>
----> 1 PathwayMDFData.calc_physiological_dg(pp)
~\Anaconda3\lib\site-packages\equilibrator_api\thermo_models.py in calc_physiological_dg(pathway)
133 [float(r.physiological_dg_correction()) for r in pathway.reactions]
134 )
--> 135 return pathway.standard_dg_primes + dg_adj
136
137 @staticmethod
~\Anaconda3\lib\site-packages\pint\quantity.py in __add__(self, other)
969 return self.to_timedelta() + other
970 else:
--> 971 return self._add_sub(other, operator.add)
972
973 __radd__ = __add__
~\Anaconda3\lib\site-packages\pint\quantity.py in wrapped(self, *args, **kwargs)
104 elif isinstance(other, list) and other and isinstance(other[0], type(self)):
105 return NotImplemented
--> 106 result = f(self, *args, **kwargs)
107 return result
108
~\Anaconda3\lib\site-packages\pint\quantity.py in _add_sub(self, other, op)
877 )
878 else:
--> 879 raise DimensionalityError(self._units, "dimensionless")
880 return self.__class__(magnitude, units)
881
DimensionalityError: Cannot convert from 'kilojoule / mole' to 'dimensionless'
It looks like in the calc_physiological_dg(pathway: object) -> np.array:
function, dg_adj is an np.array of floats, whereas pathway.standard_dg_primes is a pint array, and trying to add them together causes an error.