Skip to content

Commit

Permalink
refactor: mafftTests and cdhitTests use WSL on PC
Browse files Browse the repository at this point in the history
  • Loading branch information
edkerk committed Jan 12, 2022
1 parent 3524d52 commit 24c3021
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
14 changes: 13 additions & 1 deletion testing/unit_tests/cdhitTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,21 @@ function testCdhit(testCase)
sourceDir = fileparts(which(mfilename));
copyfile(fullfile(sourceDir,'test_data','yeast_galactosidases.fa'),tmpDIR);

% Define WSL paths
[~,wslPath.fastaFile]=system(['wsl wslpath ''' tmpDIR filesep 'yeast_galactosidases.fa''']);
wslPath.fastaFile=wslPath.fastaFile(1:end-1);
[~,wslPath.outFile]=system(['wsl wslpath ''' outFile '''']);
wslPath.outFile=wslPath.outFile(1:end-1);
[~,wslPath.cdhit]=system(['wsl wslpath ''' fullfile(ravenPath,'software','cd-hit','cd-hit') '''']);
wslPath.cdhit=wslPath.cdhit(1:end-1);

%%
%Run protein clustering with CD-HIT
[~, ~]=system(['"' fullfile(ravenPath,'software','cd-hit',['cd-hit' binEnd]) '" -T "' num2str(cores) '" -i "' fullfile(tmpDIR, 'yeast_galactosidases.fa') '" -o "' outFile '" -c 1.0 -n 5 -M 2000']);
if ispc
[~, ~]=system(['wsl "' wslPath.cdhit '" -T "' num2str(cores) '" -i "' wslPath.fastaFile '" -o "' wslPath.outFile '" -c 1.0 -n 5 -M 2000']);
else
[~, ~]=system(['"' fullfile(ravenPath,'software','cd-hit',['cd-hit' binEnd]) '" -T "' num2str(cores) '" -i "' fullfile(tmpDIR, 'yeast_galactosidases.fa') '" -o "' outFile '" -c 1.0 -n 5 -M 2000']);
end

%%
%Open actual MAFFT results file
Expand Down
10 changes: 9 additions & 1 deletion testing/unit_tests/mafftTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@ function testMafft(testCase)
sourceDir = fileparts(which(mfilename));
copyfile(fullfile(sourceDir,'test_data','yeast_galactosidases.fa'),tmpDIR);

% Define WSL paths
[~,wslPath.fastaFile]=system(['wsl wslpath ''' tmpDIR filesep 'yeast_galactosidases.fa''']);
wslPath.fastaFile=wslPath.fastaFile(1:end-1);
[~,wslPath.outFile]=system(['wsl wslpath ''' outFile '''']);
wslPath.outFile=wslPath.outFile(1:end-1);
[~,wslPath.mafft]=system(['wsl wslpath ''' fullfile(ravenPath,'software','mafft','mafft-linux64','mafft.bat') '''']);
wslPath.mafft=wslPath.mafft(1:end-1);

%%
%Run protein multi-sequence alignment with MAFFT
if ismac
[~, ~]=system(['"' fullfile(ravenPath,'software','mafft','mafft-mac','mafft.bat') '" --auto --anysymbol --thread "' num2str(cores) '" "' fullfile(tmpDIR, 'yeast_galactosidases.fa') '" > "' outFile '"']);
elseif isunix
[~, ~]=system(['"' fullfile(ravenPath,'software','mafft','mafft-linux64','mafft.bat') '" --auto --anysymbol --thread "' num2str(cores) '" "' fullfile(tmpDIR, 'yeast_galactosidases.fa') '" > "' outFile '"']);
elseif ispc
[~, ~]=system(['"' fullfile(ravenPath,'software','mafft','mafft-win','mafft.bat') '" --auto --anysymbol --thread "' num2str(cores) '" "' fullfile(tmpDIR, 'yeast_galactosidases.fa') '" > "' outFile '"']);
[~, ~]=system(['wsl "' wslPath.mafft '" --auto --anysymbol --quiet --thread "' num2str(cores) '" --out "' wslPath.outFile '" "' wslPath.fastaFile '"']);
end

%%
Expand Down

0 comments on commit 24c3021

Please sign in to comment.