Home > src > geckomat > utilities > loadFluxData.m

loadFluxData

PURPOSE ^

loadFluxData

SYNOPSIS ^

function fluxData = loadFluxData(fluxDataFile, modelAdapter)

DESCRIPTION ^

 loadFluxData
   Function that loads total protein measurements and flux data (exchange
   fluxes for carbon source,  O2, CO2, etc.)

 Input:
   fluxDataFile    path to file with flux data. (Optional, default
                   reads data/fluxData.tsv as specified in modelAdapter)
   modelAdapter    a loaded model adapter (Optional, will otherwise use
                   the default model adapter)

 Output:
   fluxData        structure with flux data
                   conds       sampling condition
                   Ptot        total protein (g/gDCW)
                   grRate      growth rate (1/h)
                   exchFluxes  exchange fluxes (mmol/gDCWh)
                   exchMets    exchanged metabolites, matching exchFluxes
                   exchRxnIDs  exchange reaction IDs, matching exchMets

 Usage:
   fluxData = loadFluxData(fluxDataFile, modelAdapter)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function fluxData = loadFluxData(fluxDataFile, modelAdapter)
0002 % loadFluxData
0003 %   Function that loads total protein measurements and flux data (exchange
0004 %   fluxes for carbon source,  O2, CO2, etc.)
0005 %
0006 % Input:
0007 %   fluxDataFile    path to file with flux data. (Optional, default
0008 %                   reads data/fluxData.tsv as specified in modelAdapter)
0009 %   modelAdapter    a loaded model adapter (Optional, will otherwise use
0010 %                   the default model adapter)
0011 %
0012 % Output:
0013 %   fluxData        structure with flux data
0014 %                   conds       sampling condition
0015 %                   Ptot        total protein (g/gDCW)
0016 %                   grRate      growth rate (1/h)
0017 %                   exchFluxes  exchange fluxes (mmol/gDCWh)
0018 %                   exchMets    exchanged metabolites, matching exchFluxes
0019 %                   exchRxnIDs  exchange reaction IDs, matching exchMets
0020 %
0021 % Usage:
0022 %   fluxData = loadFluxData(fluxDataFile, modelAdapter)
0023 
0024 if nargin < 2 || isempty(modelAdapter)
0025     modelAdapter = ModelAdapterManager.getDefault();
0026     if isempty(modelAdapter)
0027         error('Either send in a modelAdapter or set the default model adapter in the ModelAdapterManager.')
0028     end
0029 end
0030 params = modelAdapter.getParameters();
0031 
0032 if nargin < 1 || isempty(fluxDataFile)
0033     fluxDataFile = fullfile(params.path,'data','fluxData.tsv');
0034 end
0035 
0036 %Load total protein content and flux data
0037 fID       = fopen(fluxDataFile);
0038 formatStr = '%s';
0039 data      = textscan(fID,formatStr,'Delimiter','\n');
0040 fclose(fID);
0041 fluxDataRaw  = [];
0042 for i=1:length(data{1})
0043     row      = data{1}(i);
0044     row      = strsplit(row{1},'\t');
0045     row      = row(1:end);
0046     fluxDataRaw = [fluxDataRaw; row]; 
0047 end
0048 %Extract observed byProduct names from file
0049 exchRxns = fluxDataRaw(1,4:end);
0050 exchMets = strtrim(regexprep(exchRxns,'(.*)\(.*\)$','$1'));
0051 exchRxns = regexprep(exchRxns,'.*\((.*)\)$','$1');
0052 
0053 fluxData            = [];
0054 fluxData.conds      = fluxDataRaw(2:end,1);
0055 fluxData.Ptot       = str2double(fluxDataRaw(2:end,2));
0056 fluxData.grRate     = str2double(fluxDataRaw(2:end,3));
0057 fluxData.exchFluxes = str2double(fluxDataRaw(2:end,4:end));
0058 fluxData.exchMets   = exchMets;
0059 fluxData.exchRxnIDs = exchRxns;
0060 end

Generated by m2html © 2005