generateIsotopomerSolver

PURPOSE ^

wdir = which('generateIsotopomerSolver');

SYNOPSIS ^

function [experiment] = generateIsotopomerSolver(model, inputMet, experiment, FVAflag)

DESCRIPTION ^

wdir = which('generateIsotopomerSolver');
ofile = fopen(strcat(wdir, 'model_description.txt'), 'w');
 description:  
 input:  model containing standard fields and a .isotopomer field
 outputs:  none
 prints a file to /isotopomer/solver/ directory which looks like
 BiosyntheticMappingFile except that it has the indexes of every reaction
 in there as well.
 after that it calls converter.pl, optimizer.pl and validator.pl but I can
 take care of that.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [experiment] = generateIsotopomerSolver(model, inputMet, experiment, FVAflag)
0002 
0003 %wdir = which('generateIsotopomerSolver');
0004 %ofile = fopen(strcat(wdir, 'model_description.txt'), 'w');
0005 % description:
0006 % input:  model containing standard fields and a .isotopomer field
0007 % outputs:  none
0008 % prints a file to /isotopomer/solver/ directory which looks like
0009 % BiosyntheticMappingFile except that it has the indexes of every reaction
0010 % in there as well.
0011 % after that it calls converter.pl, optimizer.pl and validator.pl but I can
0012 % take care of that.
0013 
0014 
0015 oriFolder = pwd; % save working directory
0016 
0017 source_array = model.isotopomer; 
0018 Isotopomer_Info = []; 
0019 
0020 if isempty(inputMet)
0021     inputMet = 'xglcDe';
0022 end
0023 %check if experiment parameter is provided, if so turn on flag
0024 experiment_present = 0; 
0025  
0026 if (nargin > 2)
0027     experiment_present = 1; 
0028 end
0029 if nargin < 4
0030     FVAflag = false;
0031 end
0032 
0033 userxn = true(size(model.rxns));
0034 if FVAflag
0035     [m1, m2] = fluxVariability(model,0);
0036     userxn = (abs(m1) > 1e-7 | abs(m2) > 1e-7);
0037     if any(userxn == false)
0038         display('ommitting reactions due to FVA')
0039         model.rxns(userxn == false)
0040     end
0041 end
0042 
0043 for i= 1:1:length(source_array)   
0044     if(~isempty(source_array{i}) && userxn(i))
0045         [token,rem]=strtok(source_array(i)); 
0046         str = num2str(i);
0047         new_string = strcat(token,' v',str ,rem);
0048         new_string = new_string{1}; 
0049         [a,b] = strread(new_string,'%s%s','delimiter','!'); 
0050         Isotopomer_Info = vertcat(Isotopomer_Info,a,b);
0051     end
0052 end
0053 
0054 
0055 %add #Measured Metabolites# if experiment input is provided
0056 if(experiment_present)
0057     frags = experiment.fragments; 
0058     exp_names = fieldnames(frags);
0059     exp_names_len = length(exp_names);  
0060     Isotopomer_Info = vertcat(Isotopomer_Info,[],'!!Measured Metabolites!!'); 
0061     
0062     for i = 1:exp_names_len
0063             exp_name = char(exp_names(i));
0064             met = frags.(exp_name).met;
0065             fragment = frags.(exp_name).fragment;
0066             met_exp = strcat(met,'->',mat2str(fragment));
0067             Isotopomer_Info = vertcat(Isotopomer_Info,met_exp);
0068     end
0069 end
0070 
0071 % print out the input metabolite.
0072 Isotopomer_Info = vertcat(inputMet, Isotopomer_Info); 
0073 
0074 
0075 
0076 isotopomer = dataset(Isotopomer_Info); 
0077 xdir = which('generateIsotopomerSolver');
0078 xdir = strrep(xdir, 'generateIsotopomerSolver.m', '') % get only directory
0079 
0080 %export(isotopomer,'file','C:\UserSVN\isotopomer\solver\Isotopomer_Text.txt');
0081 export(isotopomer,'file',strcat(xdir,'IsotopomerModel.txt'),'WriteVarNames',false); 
0082 
0083 cd(xdir);
0084 display('generating EMU method')
0085 perl generatorEMU.pl;
0086 display('generating CUMOMER method')
0087 perl generatorCumomer.pl;
0088 display('optimizing EMU method')
0089 perl optimizerEMU.pl;
0090 display('optimizing CUMOMER method')
0091 perl optimizerCumomer.pl;
0092 
0093 cd(oriFolder); % restore working directory
0094 
0095 return

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003