GeomScale / dingo

A python library for metabolic networks sampling and analysis
GNU Lesser General Public License v3.0
41 stars 27 forks source link

dingo crashes with various metabolic models #16

Closed vissarion closed 2 years ago

vissarion commented 3 years ago

Describe the bug The following piece of code

import unittest
import os
import scipy
import numpy as np
from dingo import MetabolicNetwork, PolytopeSampler
from dingo.gurobi_based_implementations import fast_inner_ball

current_directory = os.getcwd()
input_file_json = current_directory + "/ext_data/iAB_RBC_283.json"

model = MetabolicNetwork.from_json(input_file_json)
model.set_fast_mode()

sampler = PolytopeSampler(model)
sampler.set_fast_mode()

steady_states = sampler.generate_steady_states()

returns

  File "tests/parallel.py", line 20, in <module>
    model = MetabolicNetwork.from_json(input_file_json)
  File "/home/workspace/dingo/dingo/MetabolicNetwork.py", line 74, in from_json
    return cls(tuple_args)
  File "/home/workspace/dingo/dingo/MetabolicNetwork.py", line 56, in __init__
    or (self._biomass_index < 0)
TypeError: '<' not supported between instances of 'NoneType' and 'int'

iAB_RBC_283.json is downloaded from http://bigg.ucsd.edu/

Desktop (please complete the following information):

vissarion commented 3 years ago

Similarly, for iSB619.json

The radius calculated has negative value. The polytope is infeasible or something went wrong with the solver
Traceback (most recent call last):
  File "tests/parallel.py", line 27, in <module>
    steady_states = sampler.generate_steady_states()
  File "/home/vissarion/workspace/dingo/dingo/PolytopeSampler.py", line 136, in generate_steady_states
    self._A, self._b, Tr, Tr_shift, samples = P.fast_mmcs(
  File "dingo/volestipy.pyx", line 219, in volestipy.HPolytope.fast_mmcs
    temp_center, radius = fast_inner_ball(self._A, self._b)
TypeError: 'NoneType' object is not iterable
vissarion commented 3 years ago

and for iLJ478.json

phase 1: number of correlated samples = 1200, effective sample size = 8, ratio of the maximum singilar value over the minimum singular value = 4470.89
phase 2: number of correlated samples = 1200, effective sample size = 8, ratio of the maximum singilar value over the minimum singular value = 2341.2
phase 3: number of correlated samples = 1200, effective sample size = 8, ratio of the maximum singilar value over the minimum singular value = 2240.94
phase 4: number of correlated samples = 1200, effective sample size = 8, ratio of the maximum singilar value over the minimum singular value = 738.163
phase 5: number of correlated samples = 1200, effective sample size = 9, ratio of the maximum singilar value over the minimum singular value = 30.622
phase 6: number of correlated samples = 1200, effective sample size = 38, ratio of the maximum singilar value over the minimum singular value = 17.2763
phase 7: number of correlated samples = 1200, effective sample size = 277, ratio of the maximum singilar value over the minimum singular value = 3.276
phase 8: number of correlated samples = 1200, effective sample size = 7, ratio of the maximum singilar value over the minimum singular value = 27.1693
phase 9: number of correlated samples = 1200, effective sample size = 9, ratio of the maximum singilar value over the minimum singular value = 612.636
phase 10: number of correlated samples = 1200, effective sample size = 9, ratio of the maximum singilar value over the minimum singular value = 8242.79
phase 11: number of correlated samples = 1200, effective sample size = 9, ratio of the maximum singilar value over the minimum singular value = 3117.12
phase 12: number of correlated samples = 1200, effective sample size = 8, ratio of the maximum singilar value over the minimum singular value = 28234.6
phase 13: number of correlated samples = 1200, effective sample size = 8, ratio of the maximum singilar value over the minimum singular value = 6980.29
Segmentation fault (core dumped)
hariszaf commented 3 years ago

I am not sure if this is the case, but could this be because of the starting point ?

vissarion commented 2 years ago

These are different bugs so I will open separate issues.