Home > testing > unit_tests > diamondTests.m

diamondTests

PURPOSE ^

run this test case with the command

SYNOPSIS ^

function tests = diamondTests

DESCRIPTION ^

run this test case with the command
results = runtests('diamondTests.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('diamondTests.m')
0003 function tests = diamondTests
0004 tests = functiontests(localfunctions);
0005 end
0006 
0007 function testDiamond(testCase)
0008 %This unit test comprises several functionality tests for DIAMOND blastp in
0009 %RAVEN:
0010 % 1. MD5 checksum check for DIAMOND database files.
0011 % 2. Non-parsed text check for DIAMOND result files. Although the content
0012 %    of the files is exactly the same, their MD5 hashes are somehow
0013 %    different between the operating systems.
0014 % 3. Check of resulting blastStructure against the expected one. This is
0015 %    done to test DIAMOND blastp results parsing in RAVEN.
0016 
0017 %%
0018 %Get the directory for RAVEN Toolbox
0019 [ST, I]=dbstack('-completenames');
0020 ravenPath=fileparts(fileparts(fileparts(ST(I).file)));
0021 
0022 %Import structures that contain expected MD5 hashes and DIAMOND blastp
0023 %results
0024 sourceDir = fileparts(which(mfilename));
0025 load([sourceDir,'/test_data/expDiamondResults.mat'],'expBlastStructure','expDiamondReport');
0026 
0027 organismID='sce';
0028 fastaFile=fullfile(ravenPath,'testing','unit_tests','test_data','yeast_galactosidases.fa');
0029 modelIDs={'hsa' 'afv'};
0030 refFastaFiles={fullfile(ravenPath,'testing','unit_tests','test_data','human_galactosidases.fa') fullfile(ravenPath,'testing','unit_tests','test_data','aflavus_galactosidases.fa')};
0031 
0032 %%
0033 %Run DIAMOND blastp
0034 [actBlastStructure,actDiamondReport]=getDiamond(organismID,fastaFile,modelIDs,refFastaFiles,true,true);
0035 
0036 %%
0037 %Test 1a: Check if MD5 checksums for DIAMOND blastp database files are the same
0038 verifyEqual(testCase,actDiamondReport.dbHashes,expDiamondReport.dbHashes);
0039 
0040 %Test 1b: Change one of the MD5 checksums and check if test fails
0041 actDiamondReport.dbHashes{1,1}=actDiamondReport.dbHashes{1,2};
0042 verifyNotEqual(testCase,actDiamondReport.dbHashes,expDiamondReport.dbHashes);
0043 
0044 %Test 2a: Check if DIAMOND blastp result files are the same
0045 verifyEqual(testCase,actDiamondReport.diamondTxtOutput,expDiamondReport.diamondTxtOutput);
0046 
0047 %Test 2b: Change actual DIAMOND blastp result file and check if test fails
0048 actDiamondReport.diamondTxtOutput='empty';
0049 verifyNotEqual(testCase,actDiamondReport.diamondTxtOutput,expDiamondReport.diamondTxtOutput);
0050 
0051 %Test 3a: Check if DIAMOND blastp structures are the same
0052 verifyEqual(testCase,actBlastStructure,expBlastStructure);
0053 
0054 %Test 3b: Modify actual DIAMOND blastp structure and check if test fails
0055 actBlastStructure(1,1).toId=actBlastStructure(1,1).fromId;
0056 verifyNotEqual(testCase,actBlastStructure,expBlastStructure);
0057 end

Generated by m2html © 2005