Issue with Adding Metabolite Charge Values

12 views
Skip to first unread message

Nandini Kannoju

unread,
Jul 1, 2024, 3:37:39 PMJul 1
to COBRA Toolbox

Hello, 

I hope this email finds you well.

I am currently working on adding a metabolite to a MATLAB model using the addMetabolite function. However, I have encountered an issue where the charge value I input is not being reflected in the model and is instead displaying as 'NaN'. Here are the details of the code I am using:

model = addMetabolite(model, 'T4hcinnm_e',...
'metName', 'Trans 4 Hydroxycinnamate C9H7O3',...
'metFormula', 'C9H7O3',...
'Charge', -1, ...
'csense', 'E');

I obtained the charge value from the BioCyc database for the metabolite.

After running this code, when I inspect the model, the charge for the metabolite appears as 'NaN'. I am unsure of the reason for this discrepancy and would appreciate any guidance or suggestions you might have to resolve this issue.

Thank you for your time and assistance. I look forward to your response.

Farid Zare

unread,
Jul 2, 2024, 11:58:25 AMJul 2
to cobra-...@googlegroups.com
Dear Nandini

"addMetabolite" function in the COBRA toolbox seems to work properly at the moment, so please
  • Make sure you are using the latest version of the COBRA toolbox.
  • Make sure the output model of the addMetabolite function is the one you are inspecting.
  • New metabolites are added at the end of the metabolite list in the model, so you can just check the last metabolite properties.
If none of these work, you can attach the model you are working with alongside the script you are using to this thread for further investigation.

Kind regards,
Farid
--
Farid Zare MSc
-----------------------------------------------------
Ph.D. Student at University of Galway, Ireland
LinkedIn: farid-zare
GitHub: farid-zare
GitLab: farid-zare


--

---
You received this message because you are subscribed to the Google Groups "COBRA Toolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/80cfbd24-502f-442a-b278-42250166a6e9n%40googlegroups.com.

Nandini Kannoju

unread,
Jul 2, 2024, 5:05:22 PMJul 2
to cobra-...@googlegroups.com

Dear Farid,

Thank you for your previous response. I appreciate your help.

I am encountering an issue with the "addMetabolite" function in the COBRA toolbox. While the function is working properly and I can see the added metabolites at the end of the list, I am facing a problem with the charge values. Specifically, when I assign a charge value (e.g., -1), it displays as NaN in the output model.

Below is my complete code where I am adding a new pathway. Although the reactions are balanced, I do not see the flux in the newly added pathway. I have attached the model for your reference.

Thank you !!!
clc;
clear all;
initCobraToolbox;
changeCobraSolver('glpk');
% Load SBML model using readCbModel without the 'SBML' argument
model = readCbModel('iCGB21FR.xml');
% Add p-coumarate to the model using the struct's ID
model = addMetabolite(model, 'T4hcinnm_e',...
'metName', 'Trans 4 Hydroxycinnamate C9H703',...
'metFormula', 'C9H7O3',...
'Charge', 0, ...
'csense', 'E');
% Add p-coumarate to the model using the struct's ID
model = addMetabolite(model, 'T4hcinnm_c',...
'metName', 'Trans 4 Hydroxycinnamate C9H703',...
'metFormula', 'C9H7O3',...
'Charge', -1, ...
'csense', 'E');
% Add p-coumaroyl-coa to the model using the struct's ID
model = addMetabolite(model, 'coucoa-c',...
'metName', 'P coumaroyl CoA C30H38N7O18P3S1',...
'metFormula', 'C30H38N7O18P3S',...
'Charge', -4, ...
'csense', 'E');
% Add 3S-(4-hydroxyphenyl0-3-hydroxy-propionly-CoA to the model using the struct's ID
model = addMetabolite(model, '3S-(4-hydroxyphenyl)-3-hydroxy-propionyl-CoA[c]',...
'metName', '3S-(4-hydroxyphenyl)-3-hydroxy-propionyl-CoA',...
'metFormula', 'C30H40N7O19P3S',...
'Charge', 0, ...
'csense', 'E');
% Add 4-hydroxybenzoyl-acetyl-CoA to the model using the struct's ID
model = addMetabolite(model, '4-hydroxybenzoyl-acetyl-CoA[c]',...
'metName', '4-hydroxybenzoyl-acetyl-CoA',...
'metFormula', 'C30H38N7O19P3S',...
'Charge', 0, ...
'csense', 'E');
% Add protocatechuate to the model using the struct's ID
model = addMetabolite(model, 'protocatechuate[c]',...
'metName', '3,4-Dihydroxybenzoate',...
'metFormula', 'C7H5O4',...
'Charge', -1, ...
'csense', 'E');
% Add 3-carboxy-cis,cis-muconate to the model using the struct's ID
model = addMetabolite(model, '3-carboxy-cis,cis-muconate[c]',...
'metName', 'Cis,cis-Butadiene-1,2,4-tricarboxylate',...
'metFormula', 'C7H3O6',...
'Charge', -3, ...
'csense', 'E');
% Add 2-carboxy-5-oxo-2,5-dihydrofuran-2-acetate to the model using the struct's ID
model = addMetabolite(model, '2-carboxy-5-oxo-2,5-dihydrofuran-2-acetate[c]',...
'metName', '2-carboxy-5-oxo-2,5-dihydrofuran-2-acetate',...
'metFormula', 'C7H4O6',...
'Charge', -2, ...
'csense', 'E');
% Add 3-oxoadipate enol lactone to the model using the struct's ID
model = addMetabolite(model, '3-oxoadipate enol lactone[c]',...
'metName', '3-oxoadipate enol lactone',...
'metFormula', 'C6H5O4',...
'Charge', -1, ...
'csense', 'E');
% Add 3-oxoadipate to the model
model = addMetabolite(model, '3-KETO-ADIPATE[c]',...
'metName', '3-oxoadipate',...
'metFormula', 'C6H6O5',...
'Charge', -2, ...
'csense', 'E');
% Add 3-KETO-ADIPYL-COA to the model
model = addMetabolite(model, '3-Oxoadipyl-CoA[c]',...
'metName', '3-KETO-ADIPYL-COA',...
'metFormula', 'C27H37N7O20P3S',...
'Charge', -1, ...
'csense', 'E');
% Add the exchange reaction for p-coumarate
model = addReaction(model, 'EX_p_coumarate_e', 'metaboliteList', {'T4hcinnm_e'},...
'stoichCoeffList', -1);
%model = addReaction(model, 'EX_p_coumarate_e', 'reactionFormula', 'p_coumarate[c] <=>');
%model= addExchangeRxn(model, {'p_coumarate_e','p_coumarate_c'});

% Add the transport reaction for p_coumarate
model = addReaction(model, 'pcoumaratetex', 'reactionFormula', 'T4hcinnm_e -> T4hcinnm_c');
%Add reaction between p-coumarate and P-COUMAROYL-COA
model = addReaction(model,'4-COUMARATE--COA-LIGASE-RXN','reactionFormula','T4hcinnm_c + coa[c] + atp[c] -> coucoa-c + amp[c] + ppi[c]');
%Add reaction between P-COUMAROYL-COA and 3S-(4-hydroxyphenyl)-3-hydroxy-propionyl-CoA
model = addReaction(model,'enoyl hydrase','reactionFormula','coucoa-c + h2o[c]-> 3S-(4-hydroxyphenyl)-3-hydroxy-propionyl-CoA[c] ');
%Add reaction between 3S-(4-hydroxyphenyl)-3-hydroxy-propionyl-CoA and 4-hydroxybenzoyl-acetyl-CoA
model = addReaction(model,'3-hydroxyacyl-CoA dehydrogenase','reactionFormula','3S-(4-hydroxyphenyl)-3-hydroxy-propionyl-CoA[c] + nad[c]-> 4-hydroxybenzoyl-acetyl-CoA[c] + nadh[c] + h[p]');
%Add reaction between 4-hydroxybenzoyl-acetyl-CoA and 4-hydroxybenzoate
model = addReaction(model,'3-oxoacyl-CoA ketohydrolase (acetyl-CoA forming)','reactionFormula',' 4-hydroxybenzoyl-acetyl-CoA[c] + h2o[c] -> 4hbz[c] + accoa[c]+ h[p]');
%Add reaction between 4-hydroxybenzoate and protocatechuate
model = addReaction(model,'4-HYDROXYBENZOATE-3-MONOOXYGENASE-RXN','reactionFormula','4hbz[c] + nadph[c] + o2[c] + h[p]-> protocatechuate[c] + nadp[c] + h2o[c]');
% Add reaction between protocatechuate and 3-carboxy-cis,cis-muconate
model = addReaction(model, 'PROTOCATECHUATE-34-DIOXYGENASE-RXN', 'reactionFormula', 'protocatechuate[c] + o2[c] -> 3-carboxy-cis,cis-muconate[c] + 2 h[p]');
% Add reaction between 3-carboxy-cis,cis-muconate and 2-carboxy-5-oxo-2,5-dihydrofuran-2-acetate
model = addReaction(model, 'dihydrofuranformation', 'reactionFormula', '3-carboxy-cis,cis-muconate[c] + h[p]-> 2-carboxy-5-oxo-2,5-dihydrofuran-2-acetate[c]');
% Add reaction between 2-carboxy-5-oxo-2,5-dihydrofuran-2-acetate and 3-oxoadipate enol lactone
model = addReaction(model, '3oxoadipateenolformation', 'reactionFormula', '2-carboxy-5-oxo-2,5-dihydrofuran-2-acetate[c] + h[p] -> co2[c] + 3-oxoadipate enol lactone[c]');
% Add reaction between 3-oxoadipate enol lactone and 3-KETO-ADIPATE
model = addReaction(model, '3ketoadipateformation', 'reactionFormula', '3-oxoadipate enol lactone[c] + h2o[c] -> h[p] + 3-KETO-ADIPATE[c]');
% Add reaction between 3-KETO-ADIPATE and 3-Oxoadipyl-CoA
model = addReaction(model, '3oxoadiplycoaformation', 'reactionFormula', '3-KETO-ADIPATE[c] + succoa[c]-> succ[c] + 3-Oxoadipyl-CoA[c]');
% Add reaction between 3-Oxoadipyl-CoA and 3-Oxoadipyl-CoA
model = addReaction(model, 'accoaformation', 'reactionFormula', '3-Oxoadipyl-CoA[c] + coa[c] -> succoa[c] + accoa[c]');
% Diffusion reactions
%model = changeRxnBounds(model, {'HCO3E'}, 0, 'b');
model = changeRxnBounds(model, {'GLCtex'}, 0, 'b');
model = changeRxnBounds(model, {'FRUtex'}, 0, 'b');
%model = changeRxnBounds(model, {'GLUtex'}, 0, 'b');
%model = changeRxnBounds(model, {'HCO3tex'}, 0, 'b');
model = changeRxnBounds(model, {'ALAtex'}, 0, 'b');
%model = changeRxnBounds(model, {'ARGtex'}, 0, 'b');
model = changeRxnBounds(model, {'GLYtex'}, 0, 'b');
%model = changeRxnBounds(model, {'GLNtex'}, 0, 'b');
%model = changeRxnBounds(model, {'HIStex'}, 0, 'b');
%model = changeRxnBounds(model, {'LEUtex'}, 0, 'b');
%model = changeRxnBounds(model, {'LYStex'}, 0, 'b');
%model = changeRxnBounds(model, {'PROtex'}, 0, 'b');
%model = changeRxnBounds(model, {'SERtex'}, 0, 'b');
model = changeRxnBounds(model, {'UREAtex'}, 0, 'b');
%model = changeRxnBounds(model, {'GLCGLYCtex'}, 0, 'b');
model = changeRxnBounds(model, {'SUCRtex'}, 0, 'b');
model = changeRxnBounds(model, {'PTRCtex'}, 0, 'b');
model = changeRxnBounds(model, {'SPMDtex'}, 0, 'b');
%model = changeRxnBounds(model, {'CYNTtex'}, 0, 'b');
model = changeRxnBounds(model, {'CITtex'}, 0, 'b');
%model = changeRxnBounds(model, {'MALtpp'}, 0, 'b');
%model = changeRxnBounds(model, {'MALtex'}, 0, 'b');
%model = changeRxnBounds(model, {'AKGtex'}, 0, 'b');
%model = changeRxnBounds(model, {'SUCCtpp'}, 0, 'b');
%model = changeRxnBounds(model, {'SUCCtex'}, 0, 'b');
%model = changeRxnBounds(model, {'PYRtex'}, 0, 'b');
%model = changeRxnBounds(model, {'FUMtpp'}, 0, 'b');
%model = changeRxnBounds(model, {'FUMtex'}, 0, 'b');
model = changeRxnBounds(model, {'LDH_D'}, 0, 'b');

for j = 1:1:10
% Set the uptake rate for p-coumarate:
model = changeRxnBounds(model,'EX_p_coumarate_e',-j,'l');
% Set the objective function to biomass reaction:
model = changeObjective(model, 'Growth');
% Perform FBA to calculate biomass production:
solution_biomass = optimizeCbModel(model,'max');
biomass_production_values(j) = solution_biomass.f;
end
disp(biomass_production_values);


You received this message because you are subscribed to a topic in the Google Groups "COBRA Toolbox" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cobra-toolbox/EYdQNaO4WiU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cobra-toolbo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/CACVX4vTd%2BrSGcG52cWAgwd6VNG%2BZjk5zZn7Yy_YKqHHdFMQivg%40mail.gmail.com.
iCGB21FR.zip

Farid Zare

unread,
Jul 2, 2024, 6:00:13 PMJul 2
to cobra-...@googlegroups.com
Dear Nandini

The "addMetabolite" function is working fine in your code, the problem is with the section that you are adding reactions.
Consider that the "addReaction" function also adds new metabolites in the reaction to the metabolites in the model if it cannot find the metabolites in the model. Since you didn't specify charges for these metabolites, it will assign them with NaN.
To avoid this make these improvements:
  • Keep the harmony in compartment abbreviation: e.g. replace T4hcinnm_e with T4hcinnm[e]
  • Add a space after each metabolite in the reaction formula: e.g replace "h2o[c]->" with "h2o[c] ->" and replace "accoa[c]+" with "accoa[c] +" as the code sees the "h2o[c]->" and "accoa[c]+" as new metabolites in your script.
  • Adding space between metabolite names is not permitted: e.g replace "3-oxoadipate enol lactone[c]" with "3-oxoadipate_enol_lactone[c]" (In the case of using spaces, the code sees it as three different metabolites)
Best,
Farid


Nandini Kannoju

unread,
Jul 3, 2024, 5:08:10 PM (14 days ago) Jul 3
to cobra-...@googlegroups.com

Hello Farid,

Thank you so much for your suggestions. They were incredibly helpful, and I was able to fix the problem in the code.

I appreciate your support!


Reply all
Reply to author
Forward
0 new messages