Home > testing > unit_tests > fillGapsSmallTests.m

fillGapsSmallTests

PURPOSE ^

run this test case with the command

SYNOPSIS ^

function tests = fillGapsSmallTests

DESCRIPTION ^

run this test case with the command
results = runtests('fillGapsSmallTests.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('fillGapsSmallTests.m')
0003 function tests = fillGapsSmallTests
0004 tests = functiontests(localfunctions);
0005 end
0006 
0007 function testSmallSCIP(testCase)
0008 %Test using small model
0009 sourceDir = fileparts(which(mfilename));
0010 load([sourceDir,'/test_data/ecoli_textbook.mat'], 'model');
0011 modelDB=model; % Keep as database with reactions
0012 try
0013     oldSolver=getpref('RAVEN','solver');
0014 catch
0015 end
0016 setRavenSolver('scip');
0017 
0018 %Remove first 10 reactions
0019 model=removeReactions(modelDB,(1:10));
0020 modelDB.id='DB';
0021 try
0022     evalc('[newConnected,cannotConnect,addedRxns,model,exitFlag]=fillGaps(model,modelDB)');
0023 catch
0024     try
0025         setRavenSolver(oldSolver);
0026     catch
0027         rmpref('RAVEN','solver');
0028     end
0029     error('Solver not working')
0030 end
0031 sol=solveLP(model);
0032 try
0033     setRavenSolver(oldSolver);
0034 catch
0035     rmpref('RAVEN','solver');
0036 end
0037 %Should give non-zero flux
0038 verifyTrue(testCase,-sol.f>0);
0039 end
0040 
0041 function testSmallGurobi(testCase)
0042 if exist('gurobi','file')~=3
0043     error('Gurobi not installed or cannot be found in MATLAB path, test skipped')
0044 end
0045 %Test using small model
0046 sourceDir = fileparts(which(mfilename));
0047 load([sourceDir,'/test_data/ecoli_textbook.mat'], 'model');
0048 modelDB=model; % Keep as database with reactions
0049 try
0050     oldSolver=getpref('RAVEN','solver');
0051 catch
0052 end
0053 setRavenSolver('gurobi');
0054 
0055 %Remove first 10 reactions
0056 model=removeReactions(modelDB,(1:10));
0057 
0058 modelDB.id='DB';
0059 try
0060     evalc('[newConnected,cannotConnect,addedRxns,model,exitFlag]=fillGaps(model,modelDB)');
0061 catch
0062     try
0063         setRavenSolver(oldSolver);
0064     catch
0065         rmpref('RAVEN','solver');
0066     end
0067     error('Solver not working')
0068 end
0069 sol=solveLP(model);
0070 try
0071     setRavenSolver(oldSolver);
0072 catch
0073     rmpref('RAVEN','solver');
0074 end
0075 %Expect at least 5% of the original growth
0076 verifyTrue(testCase,-sol.f>0);
0077 end

Generated by m2html © 2005