0001 function runDLKcat(modelAdapter,filePath)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 if nargin < 1 || isempty(modelAdapter)
0018 modelAdapter = ModelAdapterManager.getDefault();
0019 if isempty(modelAdapter)
0020 error('Either send in a modelAdapter or set the default model adapter in the ModelAdapterManager.')
0021 end
0022 end
0023 params = modelAdapter.params;
0024
0025 [~, params.path] = fileattrib(params.path);
0026 params.path=params.path.Name;
0027
0028 if nargin < 2 || isempty(filePath)
0029 filePath = fullfile(params.path,'data','DLKcat.tsv');
0030 elseif strcmp(filePath(end),{'\','/'})
0031 filePath = fullfile(filePath,'DLKcat.tsv');
0032 end
0033 filePath = checkFileExistence(filePath,1);
0034
0035 copyfile(filePath, fullfile(params.path,'data','tempDLKcat.tsv'));
0036
0037
0038
0039
0040
0041 if ismac
0042 setenv('PATH', strcat('/usr/local/bin', ':', getenv("PATH")));
0043 end
0044
0045
0046 [checks.docker.status, checks.docker.out] = system('docker --version');
0047 if checks.docker.status ~= 0
0048 error('Cannot find Docker, make sure it is installed. If it is, it might be required to start Matlab from the command-line instead of the launcher in order for Docker to be detected and used.')
0049 end
0050
0051 disp('Running DLKcat prediction, this may take many minutes, especially the first time.')
0052 status = system(['docker run --rm -v "' fullfile(params.path,'/data') '":/data ghcr.io/sysbiochalmers/dlkcat-gecko:0.1 /bin/bash -c "python DLKcat.py /data/tempDLKcat.tsv /data/tempDLKcatOutput.tsv"']);
0053 delete(fullfile(params.path,'/data/tempDLKcat.tsv'));
0054
0055 if status == 0 && exist(fullfile(params.path,'data/tempDLKcatOutput.tsv'))
0056 movefile(fullfile(params.path,'/data/tempDLKcatOutput.tsv'), filePath);
0057 disp('DKLcat prediction completed.');
0058 else
0059 error('DLKcat encountered an error or it did not create any output file.')
0060 end
0061