% 6/18/2006
% Thuy D. Vo, Bernhard Palsson Laboratory
% University of California, San Diego

load Smat;
[m,n] = size(S);

MET = char('12dgr_C', '13dpg_C', '2pg_C', '3pg_C', '5aop_C', 'ac_C', 'acac_C', 'accoa_C', 'acrn_C', 'adp_C', 'akg_C', 'alaL_C', 'amp_C', 'arachd_C', 'arachdcoa_C', 'arachdcrn_C', 'argL_C', 'aspL_C', 'atp_C', 'bhb_C', 'bilirub_C', 'biliverd_C', 'c226coa_C', 'c226crn_C', 'cdp_C', 'cdpchol_C', 'chol_C', 'cholp_C', 'cit_C', 'citrL_C', 'cmp_C', 'co_C', 'co2_C', 'coa_C', 'cpppg3_C', 'crn_C', 'crvnc_C', 'ctp_C', 'cysL_C', 'dhap_C', 'f6p_C', 'fdp_C', 'fe2_C', 'fum_C', 'g3p_C', 'g6p_C', 'gdp_C', 'glcD_C', 'glnL_C', 'gluL_C', 'glucys_C', 'gly_C', 'glyc_C', 'gthrd_C', 'gtp_C', 'h_C', 'h2o_C', 'hdca_C', 'hdcea_C', 'hdcecrn_C', 'hdcoa_C', 'hmbil_C', 'k_C', 'lacL_C', 'malL_C', 'na1_C', 'nad_C', 'nadh_C', 'nadp_C', 'nadph_C', 'nh4_C', 'o2_C', 'oaa_C', 'occoa_C', 'ocdca_C', 'ocdcea_C', 'ocdcya_C', 'ocdycacoa_C', 'ocdycrn_C', 'octa_C', 'odecoa_C', 'odecrn_C', 'oh1_C', 'orn_C', 'pc_C', 'pep_C', 'pheme_C', 'pi_C', 'pmtcoa_C', 'pmtcrn_C', 'ppa_C', 'ppbng_C', 'ppi_C', 'pppg9_C', 'ps_C', 'pyr_C', 'stcoa_C', 'stcrn_C', 'succ_C', 'uppg3_C', '12dgr_E', 'ac_E', 'acac_E', 'alaL_E', 'arachd_E', 'bhb_E', 'bilirub_E', 'chol_E', 'cit_E', 'co_E', 'co2_E', 'coa_E', 'crvnc_E', 'fe2_E', 'glcD_E', 'glnL_E', 'gluL_E', 'gly_E', 'glyc_E', 'h_E', 'h2o_E', 'hdca_E', 'hdcea_E', 'k_E', 'lacL_E', 'na1_E', 'nh4_E', 'o2_E', 'ocdca_E', 'ocdcea_E', 'ocdcya_E', 'octa_E', 'pi_E', 'ppa_E', 'ps_E', 'pyr_E', 'succ_E', '12dgr', '1ag3p', '5aop', 'aacoa', 'ac', 'acac', 'accoa', 'acrn', 'adp', 'akg', 'amp', 'arachdcoa', 'arachdcrn', 'argL', 'asnL', 'aspL', 'atp', 'bhb', 'c226coa', 'c226crn', 'cdp', 'cdpdag', 'cdpea', 'chol', 'cit', 'citrL', 'clpn', 'cmp', 'co2', 'coa', 'creat', 'crn', 'ctp', 'dhap', 'facoa_hg', 'fad', 'fadh2', 'fe2', 'ficytC', 'focytC', 'fum', 'gdp', 'glnL', 'gluL', 'gly', 'glyc', 'glyc3p', 'gthox', 'gthrd', 'gtp', 'h', 'h2co3', 'h2o', 'h2o2', 'hco3', 'hdcecrn', 'hdcoa', 'hmgcoa', 'icit', 'lacL', 'malL', 'malcoa', 'mmcoaR', 'mmcoaS', 'nad', 'nadh', 'nadp', 'nadph', 'nh4', 'o2', 'o2s', 'oaa', 'occoa', 'ocdycacoa', 'ocdycrn', 'odecoa', 'odecrn', 'orn', 'pa', 'pc', 'pcreat', 'pcrn', 'pe', 'pep', 'pg', 'pgp', 'pheme', 'pi', 'pmtcoa', 'pmtcrn', 'ppa', 'ppcoa', 'ppi', 'ppp9', 'pppg9', 'ps', 'pyr', 'q10', 'q10h2', 'stcoa', 'stcrn', 'succ', 'succoa');
RXN = char('DMatp_C', 'DMpheme_C', 'DMphoslipid', 'EX12dgr_E', 'EXac_E', 'EXacac_E', 'EXalaL_E', 'EXarachd_E', 'EXbhb_E', 'EXbilirub_E', 'EXchol_E', 'EXcit_E', 'EXco_E', 'EXco2_E', 'EXcoa_E', 'EXcrvnc_E', 'EXfe2_E', 'EXglc_E', 'EXglnL_E', 'EXgluL_E', 'EXgly_E', 'EXglyc_E', 'EXh_E', 'EXh2o_E', 'EXhdca_E', 'EXhdcea_E', 'EXlacL_E', 'EXna1_E', 'EXnh4_E', 'EXo2_E', 'EXocdca_E', 'EXocdcea_E', 'EXocdcya_E', 'EXocta_E', 'EXpi_E', 'EXppa_E', 'EXps_E', 'EXpyr_E', 'EXsucc_E', '12DGRt2', '5AOPtm', 'ACACT1rm', 'ACACt2', 'ACACtm2', 'ACCOACm', 'ACCOALm', 'ACITL', 'ACONTm', 'ACRNtm', 'ACSm', 'ACt2', 'ACt2m', 'ADK1', 'ADK1m', 'AGATmHG', 'AKGDm', 'AKGMALtm', 'ALASm', 'ALATAL', 'ALAt4', 'ALAtN1', 'ARACHDt', 'ARGtm', 'ASNNm', 'ASPGLUm', 'ASPTA', 'ASPTAm', 'ATPCTPm', 'ATPS4m', 'ATPtm', 'BDHm', 'BHBt', 'BHBtm', 'BILIRED', 'BILIRUBt', 'C160CPT1', 'C160CPT2', 'C160CRNt', 'C161CPT1', 'C161CPT2', 'C161CRNt', 'C180CPT1', 'C180CPT2', 'C180CRNt', 'C181CPT1', 'C181CPT2', 'C181CRNt', 'C182CPT1', 'C182CPT2', 'C182CRNt', 'C204CPT1', 'C204CPT2', 'C204CRNt', 'C226CPT1', 'C226CPT2', 'C226CRNt', 'CATm', 'CHLPCTD', 'CHOLK', 'CHOLt4', 'CITRtm', 'CITt4', 'CITtam', 'CITtbm', 'CK', 'CLPNS', 'CO2t', 'CO2tm', 'COAt', 'COAtm', 'COt', 'CPPPGO', 'CRNtim', 'CRVNCt', 'CSNAT2m', 'CSNATm', 'CSm', 'CYOOm3', 'CYORu10m', 'CYTK1', 'DAGCPT', 'DASYN', 'DNC1C', 'DNC1G', 'ENO', 'ETHAPT', 'FACOAL160i', 'FACOAL161i', 'FACOAL180i', 'FACOAL181i', 'FACOAL182i', 'FACOAL204i', 'FACOAL226i', 'FACOAL80i', 'FAOXC160', 'FAOXC180', 'FAOXC181', 'FAOXC182', 'FAOXC204', 'FAOXC226', 'FAOXC80', 'FAS160N', 'FASYNH', 'FBA', 'FCLTm', 'FE2t1', 'FE2tm', 'FUMm', 'FUMtm', 'G3PATmHG', 'G3PDm', 'GAPD', 'GLCt1', 'GLNS', 'GLNt4', 'GLNtN1', 'GLNtm', 'GLUCYS', 'GLUDxm', 'GLUDym', 'GLUNm', 'GLUt1', 'GLUt2m', 'GLUt4', 'GLYCt1', 'GLYCtm', 'GLYKm', 'GLYt4', 'GLYtm', 'GTHOm', 'GTHPm', 'GTHRDt', 'GTHS', 'GTPtm', 'H2CO3Dm', 'H2OD', 'H2Ot', 'H2Otm', 'HCO3Em', 'HDCAt', 'HDCEAt', 'HEX1', 'HMBS', 'HMGCOASim', 'HMGLm', 'HOXG', 'Ht', 'Htm', 'ICDHxm', 'ICDHym', 'Kt1r', 'LLACt2r', 'LLACtm', 'LDHL', 'LDHLm', 'MALtm', 'MCD', 'MDH', 'MDHm', 'ME2m', 'MMEm', 'MMMm', 'NADH2u10m', 'NDPK1', 'NDPK3', 'NH4t', 'NH4tm', 'NaKt', 'O2t', 'O2tm', 'OCCOAtm', 'OCDCAt', 'OCDCEAt', 'OCDCYAt', 'OCOAT1m', 'OCTAt3', 'ORNt3m', 'ORNt4m', 'PAPA', 'PCHOLP', 'PCm', 'PCt2m', 'PDHm', 'PEPCKm', 'PFK', 'PGI', 'PGK', 'PGM', 'PGPP', 'PGSA', 'PHEMEt', 'PIt2m', 'PIt2r', 'PPA', 'PPAm', 'PPAt', 'PPAtm', 'PPBNGS', 'PPCOACm', 'PPPG9tm', 'PPPGOm', 'PSD', 'PSt2', 'PSt2m', 'PYK', 'PYRt2m', 'PYRt2r', 'SPODMm', 'SUCCt', 'SUCCt2m', 'SUCD1m', 'SUCD3u10m', 'SUCOAS1m', 'THD1m', 'TPI', 'UPP3S', 'UPPDC1');

Reversible = [0 1 1 1 1 0 0 0 1 0 0 0 1 1 1 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 0 0 0 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 0 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 0 0 1 0 1 1 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 0 0 0 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 1 1 0 1 1 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 0 0 1 0 0 1 0 0 1 1 0 1 1 1 1 1 1 1 0 0];
exch_Rxn = [1:39];
Reversible = [ones(1,length(exch_Rxn)) Reversible];
Reversible_ind = find(Reversible);

%LB and UB have to be column vectors
LB = [0 0 0 0 0 0 0 0 0 0 0 0 0 -999 -999 0 -999 -1 0 0 0 0 -999 -999 0 0 0 -999 0 -999 0 0 0 0 -999 0 0 0 0 0 -999 -999 -999 -999 0 0 0 -999 0 0 0 -999 -999 -999 0 0 -999 0 -999 0 0 0 -999 0 -999 -999 -999 -999 0 0 -999 -999 -999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 0 0 0 -999 -999 0 0 0 -999 0 -999 -999 -999 -999 -999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -999 0 -999 0 -999 -999 0 0 -999 0 0 0 0 0 0 -999 -999 0 0 -999 0 0 -999 0 0 -999 0 -999 -999 0 0 -999 -999 -999 -999 -999 0 0 0 0 0 0 0 -999 0 0 0 -999 -999 -999 -999 -1 -999 0 -999 -999 0 -999 -999 0 -999 -999 -999 -999 0 -999 -999 0 0 0 0 -999 0 -999 -999 0 0 0 0 0 0 0 -999 -999 -999 0 0 -999 -999 -999 0 0 0 0 0 0 -999 0 0 -999 0 0 -999 -999 0 -999 -999 -999 -999 -999 0 -999 0 0]';
UB = 999*ones(length(LB),1);

% These bounds are set at 2 standard deviations around the mean
% See Khairallah et al, 2004
LB(12) = 0.015;     UB(12) = 0.019;			%citrate
LB(18) = -10;       UB(18) = -(1.33+0.125);	%glucose
LB(27) = 1.33;      UB(27) = 2.17;			%lactate
LB(30) = -7.05;     UB(30) = -5.45;			%o2
LB(32) = -0.3;      UB(32) = 0;				%oleate
LB(38) = 0.125;     UB(38) = 0.625;			%pyruvate
LB(39) = 0.005;     UB(39) = 0.017;			%succinate
LB(195) = -0.5;     UB(195) = 0.5;			%Mitochondrial lactate dehydrogenase

