Home > testing > unit_tests > blastPlusTests.m

blastPlusTests

PURPOSE ^

run this test case with the command

SYNOPSIS ^

function tests = blastPlusTests

DESCRIPTION ^

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

Generated by m2html © 2005