|
6 | 6 | initTestSuite;
|
7 | 7 | end
|
8 | 8 |
|
| 9 | +function testPandaPantest() |
| 10 | + % Tell if this is Octave (Unit tests) or Matlab |
| 11 | + isOctave = exist('OCTAVE_VERSION', 'builtin') ~= 0; |
| 12 | + |
| 13 | + % Load statistics package from Octave |
| 14 | + if isOctave |
| 15 | + %we need the nan package because it has a fast implementation of corrcoeff |
| 16 | + %pkg load statistics |
| 17 | + pkg load nan; |
| 18 | + return % readtable is not available in octave |
| 19 | + end |
| 20 | + |
| 21 | + % Set Program Parameters |
| 22 | + exp_file = 'tests/test_data/pantests/expression.txt'; |
| 23 | + motif_file = 'tests/test_data/pantests/motif.txt'; |
| 24 | + ppi_file = 'tests/test_data/pantests/ppi.txt'; |
| 25 | + panda_out = ''; % optional, leave empty if file output is not required |
| 26 | + save_temp = ''; % optional, leave empty if temp data files will not be needed afterward |
| 27 | + lib_path = '../netZooM'; % path to the folder of PANDA source code |
| 28 | + alpha = 0.1; |
| 29 | + save_pairs = 0;%saving in .pairs format |
| 30 | + modeProcess= 'legacy'; |
| 31 | + |
| 32 | + % Add path |
| 33 | + addpath(genpath(fullfile(pwd,'tests'))); |
| 34 | + |
| 35 | + % Call Panda |
| 36 | + tic;[AgNet,TFNames,GeneNames] = panda_run(lib_path,exp_file, motif_file, ppi_file, panda_out,... |
| 37 | + save_temp, alpha, save_pairs, modeProcess);toc; |
| 38 | + ExpTbl = array2table(AgNet,'RowNames',TFNames,'VariableNames',GeneNames'); |
| 39 | + |
| 40 | + % Load the expected result |
| 41 | + filename = 'panda_pantests_gt_matlab.csv'; |
| 42 | + ExpAgNet = readtable(filename,'ReadVariableNames',1,'ReadRowNames',1,'PreserveVariableNames',1); |
| 43 | + |
| 44 | + % Compare the outputs |
| 45 | + tolMat =1e-6; |
| 46 | + deltaMat=max(max(abs(ExpTbl{:,:}-ExpAgNet{:,:}))); |
| 47 | + assertTrue( deltaMat < tolMat ); |
| 48 | + |
| 49 | +end |
| 50 | + |
| 51 | +function testPandaPythonData() |
| 52 | + % Tell if this is Octave (Unit tests) or Matlab |
| 53 | + isOctave = exist('OCTAVE_VERSION', 'builtin') ~= 0; |
| 54 | + |
| 55 | + % Load statistics package from Octave |
| 56 | + if isOctave |
| 57 | + %we need the nan package because it has a fast implementation of corrcoeff |
| 58 | + %pkg load statistics |
| 59 | + pkg load nan; |
| 60 | + return % readtable is not available in octave |
| 61 | + end |
| 62 | + |
| 63 | + % Set Program Parameters |
| 64 | + exp_file = 'tests/test_data/panda/ToyExpressionData.txt'; |
| 65 | + motif_file = 'tests/test_data/panda/ToyMotifData.txt'; |
| 66 | + ppi_file = 'tests/test_data/panda/ToyPPIData.txt'; |
| 67 | + panda_out = ''; % optional, leave empty if file output is not required |
| 68 | + save_temp = ''; % optional, leave empty if temp data files will not be needed afterward |
| 69 | + lib_path = '../netZooM'; % path to the folder of PANDA source code |
| 70 | + alpha = 0.1; |
| 71 | + save_pairs = 0;%saving in .pairs format |
| 72 | + modeProcess= 'legacy'; |
| 73 | + |
| 74 | + % Add path |
| 75 | + addpath(genpath(fullfile(pwd,'tests'))); |
| 76 | + |
| 77 | + % Call Panda |
| 78 | + tic;[AgNet,TFNames,GeneNames] = panda_run(lib_path,exp_file, motif_file, ppi_file, panda_out,... |
| 79 | + save_temp, alpha, save_pairs, modeProcess);toc; |
| 80 | + ExpTbl = array2table(AgNet,'RowNames',TFNames,'VariableNames',GeneNames'); |
| 81 | + |
| 82 | + % Load the expected result |
| 83 | + filename = 'panda_gt_matlab.csv'; |
| 84 | + ExpAgNet = readtable(filename,'ReadVariableNames',1,'ReadRowNames',1,'PreserveVariableNames',1); |
| 85 | + |
| 86 | + % Compare the outputs |
| 87 | + tolMat =1e-6; |
| 88 | + deltaMat=max(max(abs(ExpTbl{:,:}-ExpAgNet{:,:}))); |
| 89 | + assertTrue( deltaMat < tolMat ); |
| 90 | +end |
| 91 | + |
9 | 92 | function testPandaSimple()
|
10 | 93 | % Tell if this is Octave (Unit tests) or Matlab
|
11 | 94 | isOctave = exist('OCTAVE_VERSION', 'builtin') ~= 0;
|
|
0 commit comments