testForTypeIIIPathways

PURPOSE ^

testForTypeIIIPathways Set up the model to run extreme pathway analysis

SYNOPSIS ^

function testForTypeIIIPathways(model,ListExch,filename)

DESCRIPTION ^

testForTypeIIIPathways Set up the model to run extreme pathway analysis 
(expa) for identifying loops in the model (Type III pathways) and runs expa.

 TestForTypeIIIPathways(model,ListExch)

INPUTS
 model     COBRA model structure
 ListExch  List of position of exchange reactions in S matrix


 Ines Thiele   02/09

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function testForTypeIIIPathways(model,ListExch,filename)
0002 %testForTypeIIIPathways Set up the model to run extreme pathway analysis
0003 %(expa) for identifying loops in the model (Type III pathways) and runs expa.
0004 %
0005 % TestForTypeIIIPathways(model,ListExch)
0006 %
0007 %INPUTS
0008 % model     COBRA model structure
0009 % ListExch  List of position of exchange reactions in S matrix
0010 %
0011 %
0012 % Ines Thiele   02/09
0013 
0014 warning off all
0015 if nargin < 3
0016     filename = 'ModelTestTypeIII';
0017 end
0018 
0019 % set exchange constraints to 0
0020 model.lb(ListExch)=0;
0021 model.ub(ListExch)=0;
0022 
0023 tol = 1e-10;
0024 
0025 % flux variability analysis
0026 cnt=1;
0027 for i = 1:size(model.lb,1)
0028     model.c(logical(model.c)) = 0;
0029     model.c(i,1) = 1;
0030     solMax=optimizeCbModel(model,'max');
0031     SolMin=optimizeCbModel(model,'min');
0032     MinMax(i,:)=[SolMin.f solMax.f];
0033     if (SolMin.f==solMax.f && abs(SolMin.f) <= tol)
0034         rxnzero(cnt,1)=i;
0035         cnt=cnt+1;
0036     end
0037     if (SolMin.f<0)
0038         model.rev(i)=1;
0039     else
0040         model.rev(i)=0;
0041     end
0042 end
0043 
0044 % write expa file
0045 convertModelToEX(model,strcat(filename, '.expa'),ListExch,rxnzero);
0046 
0047 % run expa analysis
0048 [status,result] = dos(['X3 -p ' strcat(filename, '.expa')]);
0049 
0050 if strfind(result,'ERROR')>0
0051     fprintf('\n Error with X3.exe:\n');
0052     fprintf('%s\n',result);
0053 else
0054     % check if Type III pathways were found
0055     if result(strfind(result,'There are ') + length('There are ')) > 0
0056         fprintf('Type III pathways were found in model. A table of Type III pathways can be found in ');
0057         fprintf('%s',strcat(filename,'_myT3.txt'));
0058         fprintf(' or as  Sparse format in ');
0059         fprintf('%s',strcat(filename,'_myT3_Sprs.txt'));
0060     else
0061         fprintf('No Type III pathways can be found in model.');
0062         dos(['rm ' strcat(filename,'_myT3_Sprs.txt') strcat(filename,'_myT3.txt') strcat(filename,'_myRxnMet.txt')]);
0063     end
0064     % clean up files
0065     dos(['del ' strcat(filename,'_myPaths.txt') ' ' strcat(filename,'_myPaths_sparse.txt')]);
0066 end

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