opencobra / cobratoolbox

The COnstraint-Based Reconstruction and Analysis Toolbox. Documentation:
https://opencobra.github.io/cobratoolbox
Other
241 stars 305 forks source link

Error using sampleCbModel #1527

Open JunGeng opened 4 years ago

JunGeng commented 4 years ago

*I am trying to use the random sampling method of cobratoolbox to obtain all possible flux distribution for the maximal growth rate condition. I try to fulfill this goal by using sampleCbModel in cobratoolbox. However, I encountered the problem of "x0 is not interior". I have searched a lot similar issues online, but no solution works for me. I will really appreciate if anyone can help to fix this problem!

Here is how I formulate my optimization problem: Step1: using normal FBA to obtain the maiximal growth rate under given constraint settings for substrates Step2: Using the same constraints settings in Step1, in addition, fix the growth rate as the maximal growth rate obtained from Step1, call sampleCbModel function with parameters as below: options.nStepsPerPoint = 200; options.nPointsReturned = 10000; %% since my reactions number in total > 8000 options.toRound = 1; [ModelSampling, SampleResults] = sampleCbModel(Cobra_model, [], [], options);

Error message: Checking for width 0 facets... Currently (P.A, P.b) are in 10734 dimensions Checking for width 0 facets... Starting parallel pool (parpool) using the 'local' profile ... connected to 4 workers. Found 4627 degenerate reactions, adding them to the equality subspace.

In preprocess (line 169) In chrrSampler (line 110) In sampleCbModel (line 162) In runFBA_urea_obj_CBRS_Growth (line 112) In normalizeAndRunFBA_consMass_Cobra (line 47) In runSimulation_consMass_Cobra (line 67) In Food_maxGrowth_Cobra (line 87) In getDietGrowthRate (line 28) In DietRandomSampling (line 106) Warning: Rank deficient, rank = 7988, tol = 7.610415e-06. Now in 2739 dimensions after restricting Removed 12210 zero rows Preconditioning A with gmscale Rounding... Error using mve_solver_cobra (line 29) x0 not interior

Error in mve_run_cobra (line 32) [x,E2,converged] = mve_solver_cobra(A,b,x0,maxiter,tol2,reg); %Ben

Error in preprocess (line 250) [T_shift, Tmve,converged] = mve_run_cobra(P.A,P.b, x0,reg);

Error in chrrSampler (line 110) [roundedPolytope] = preprocess(P,options);

Error in sampleCbModel (line 162) [samples, modelSampling] = chrrSampler(model, nStepsPerPoint, nPointsReturned, toRound, modelSampling, useFastFVA,optPercentage);

I have checked both lower bound/upper bound of the model, all of them are within range of [-1000,1000], no Inf/-Inf

Therefore, I was really confused why this happens. I will really appreciate if you can give any suggestions to fix this.

By the way, the solver during above calculation is "Gurobi"*

I hereby confirm that I have:

(Note: You may replace [ ] with [X] to check the box)

rmtfleming commented 4 years ago

Post to here: https://groups.google.com/forum/#!forum/cobra-toolbox

On Wed, 4 Dec 2019 at 14:36, JunGeng notifications@github.com wrote:

*I am trying to use the random sampling method of cobratoolbox to obtain all possible flux distribution for the maximal growth rate condition. I try to fulfill this goal by using sampleCbModel in cobratoolbox. However, I encountered the problem of "x0 is not interior". I have searched a lot similar issues online, but no solution works for me. I will really appreciate if anyone can help to fix this problem!

Here is how I formulate my optimization problem: Step1: using normal FBA to obtain the maiximal growth rate under given constraint settings for substrates Step2: Using the same constraints settings in Step1, in addition, fix the growth rate as the maximal growth rate obtained from Step1, call sampleCbModel function with parameters as below: options.nStepsPerPoint = 200; options.nPointsReturned = 10000; %% since my reactions number in total > 8000 options.toRound = 1; [ModelSampling, SampleResults] = sampleCbModel(Cobra_model, [], [], options);

Error message: Checking for width 0 facets... Currently (P.A, P.b) are in 10734 dimensions Checking for width 0 facets... Starting parallel pool (parpool) using the 'local' profile ... connected to 4 workers. Found 4627 degenerate reactions, adding them to the equality subspace.

In preprocess (line 169) In chrrSampler (line 110) In sampleCbModel (line 162) In runFBA_urea_obj_CBRS_Growth (line 112) In normalizeAndRunFBA_consMass_Cobra (line 47) In runSimulation_consMass_Cobra (line 67) In Food_maxGrowth_Cobra (line 87) In getDietGrowthRate (line 28) In DietRandomSampling (line 106) Warning: Rank deficient, rank = 7988, tol = 7.610415e-06. Now in 2739 dimensions after restricting Removed 12210 zero rows Preconditioning A with gmscale Rounding... Error using mve_solver_cobra (line 29) x0 not interior

Error in mve_run_cobra (line 32) [x,E2,converged] = mve_solver_cobra(A,b,x0,maxiter,tol2,reg); %Ben

Error in preprocess (line 250) [T_shift, Tmve,converged] = mve_run_cobra(P.A,P.b, x0,reg);

Error in chrrSampler (line 110) [roundedPolytope] = preprocess(P,options);

Error in sampleCbModel (line 162) [samples, modelSampling] = chrrSampler(model, nStepsPerPoint, nPointsReturned, toRound, modelSampling, useFastFVA,optPercentage);

I have checked both lower bound/upper bound of the model, all of them are within range of [-1000,1000], no Inf/-Inf

Therefore, I was really confused why this happens. I will really appreciate if you can give any suggestions to fix this.

By the way, the solver during above calculation is "Gurobi"*

I hereby confirm that I have:

  • X Tried to solve the issue on my own
  • X Retried to run my code with the latest version of The COBRA Toolbox
  • X Checked that a similar issue has not already been opened

(Note: You may replace [ ] with [X] to check the box)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/opencobra/cobratoolbox/issues/1527?email_source=notifications&email_token=AAQMEORBI7GL2G3HQCYBJKTQW655LA5CNFSM4JVJS3JKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H6AXNTQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQMEOSWTHMEIVJZIS6FFRLQW655LANCNFSM4JVJS3JA .

--

Mr. Ronan MT Fleming B.V.M.S. Dip. Math. Ph.D.

Assistant Professor, Division of Systems Biomedicine and Pharmacology, Leiden Academic Centre for Drug Research, Faculty of Science, Leiden University. https://www.universiteitleiden.nl/en/staffmembers/ronan-fleming & H2020 Project Coordinator, Systems Medicine of Mitochondrial Parkinson’s Disease, http://sysmedpd.eu & Adjunct Lecturer, School of Medicine, National University of Ireland, Galway.

Peer-reviewed publications: https://goo.gl/FZPG23 Mobile: +353 873 413 072 Skype: ronan.fleming

Upcoming course from 25-29 November 2019, at Leiden University on "Constraint-based modelling: introduction and advanced topics". https://www.biosb.nl/archive-courses/constraint-based-modelling-introduction-and-advanced-topics-2019/

(This message is confidential and may contain privileged information. It is intended for the named recipient only. If you receive it in error please notify me and permanently delete the original message and any copies.)

JunGeng commented 4 years ago

Dear Dr. Fleming,

 Thank you very much for your prompt reply.
 I have sent the application to be added into the group. And I will post my issue there. Hopefully it could get fixed!
 Thank you very much!

Best regards, JG

JunGeng commented 4 years ago

@rmtfleming Dear Dr. Fleming, I am still waiting for being added into the google group such that I can post my issue there. I will appreciate it very much if my application to join the group could be proceeded! Thank you very much!

Best regards, JG

rmtfleming commented 4 years ago

Have you been added? Check if it runs with lb < ub rather than some lb = ub.

JunGeng commented 4 years ago

Dear Dr. Fleming,

 Thank you very much for your kind reply regarding my issue!
 I tried to add the forum group multiple times and all are rejected. Could you please issue the permission of my account with gjun0317@gmail.com<mailto:gjun0317@gmail.com>?
 Do you mean to relax all the “eq” constraints and let them not be equal exactly?
 Currently, this is my problem:
  1. I set some exchange reactions of my model with a lower bound to let them be uptaken with a specific range.
  2. The biomass lower bound is set up as 0 since I am afraid if too strict value would give very small solution space.
  3. The maintenance lower bound is set as the specific value.
  4. No objective function is defined.
  5. I can run the FVA analysis, and there is ~1000 reactions cannot take any fluxes. But I assume this would not affect the results. The thing is if I set -1000 as the lb in step1, there is solutions. However, if I set them as the actual value consistent with my medium, the simulation crashes. I will appreciate your suggestions very much if there is anything wrong or problematic above.

Thank you very much!

Best regards, Jun

From: "Ronan M.T. Fleming" notifications@github.com Reply-To: opencobra/cobratoolbox reply@reply.github.com Date: Thursday, December 19, 2019 at 2:03 PM To: opencobra/cobratoolbox cobratoolbox@noreply.github.com Cc: Jun Geng gejun@chalmers.se, Author author@noreply.github.com Subject: Re: [opencobra/cobratoolbox] Error using sampleCbModel (#1527)

Have you been added? Check if it runs with lb < ub rather than some lb = ub.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/opencobra/cobratoolbox/issues/1527?email_source=notifications&email_token=AHUCV6SFCAPXKCP53WLUWDDQZNWJ5A5CNFSM4JVJS3JKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHJRDYY#issuecomment-567480803, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHUCV6WXN53V2BGM6IB4DP3QZNWJ5ANCNFSM4JVJS3JA.