Home > testing > unit_tests > fillGapsLargeTests.m

fillGapsLargeTests

PURPOSE ^

run this test case with the command

SYNOPSIS ^

function tests = fillGapsLargeTests

DESCRIPTION ^

run this test case with the command
results = runtests('fillGapsLargeTests.m')

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 %run this test case with the command
0002 %results = runtests('fillGapsLargeTests.m')
0003 function tests = fillGapsLargeTests
0004 tests = functiontests(localfunctions);
0005 end
0006 
0007 function testLargeGurobi(testCase)
0008 if exist('gurobi','file')~=3
0009     error('Gurobi not installed or cannot be found in MATLAB path, test skipped')
0010 end
0011 sourceDir = fileparts(fileparts(fileparts(which(mfilename))));
0012 evalc('model=importModel(fullfile(sourceDir,''tutorial'',''iAL1006 v1.00.xml''))');
0013 model.c(1484)=1;
0014 modelDB=model; % Keep as database with reactions
0015 try
0016     oldSolver=getpref('RAVEN','solver');
0017 catch
0018 end
0019 setRavenSolver('gurobi');
0020 
0021 %Remove first 10 reactions
0022 model=removeReactions(modelDB,(1:10));
0023 modelDB.id='DB';
0024 try
0025     evalc('[newConnected,cannotConnect,addedRxns,model,exitFlag]=fillGaps(model,modelDB,false,false)');
0026 catch
0027     try
0028         setRavenSolver(oldSolver);
0029     catch
0030         rmpref('RAVEN','solver');
0031     end
0032     error('Solver not working')
0033 end
0034 sol=solveLP(model);
0035 try
0036     setRavenSolver(oldSolver);
0037 catch
0038     rmpref('RAVEN','solver');
0039 end
0040 %Expect at least 5% of the original growth
0041 verifyTrue(testCase,-sol.f>0);
0042 end
0043 
0044 function testLargeSCIP(testCase)
0045 sourceDir = fileparts(fileparts(fileparts(which(mfilename))));
0046 evalc('model=importModel(fullfile(sourceDir,''tutorial'',''iAL1006 v1.00.xml''))');
0047 model.c(1484)=1;
0048 modelDB=model; % Keep as database with reactions
0049 % Force growth in gapped model
0050 sol=solveLP(model);
0051 model.lb(1484)=abs(sol.f*0.1);
0052 try
0053     oldSolver=getpref('RAVEN','solver');
0054 catch
0055 end
0056 setRavenSolver('scip');
0057 
0058 %Remove first 10 reactions
0059 model=removeReactions(model,(1:10));
0060 modelDB.id='DB';
0061 try
0062     evalc('[newConnected,cannotConnect,addedRxns,model,exitFlag]=fillGaps(model,modelDB,false,true)');
0063 catch
0064     try
0065         setRavenSolver(oldSolver);
0066     catch
0067         rmpref('RAVEN','solver');
0068     end
0069     error('Solver not working')
0070 end
0071 sol=solveLP(model);
0072 try
0073     setRavenSolver(oldSolver);
0074 catch
0075     rmpref('RAVEN','solver');
0076 end
0077 %Expect at least 5% of the original growth
0078 verifyTrue(testCase,-sol.f>0);
0079 end

Generated by m2html © 2005