-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathWorkflow.m
79 lines (62 loc) · 3.41 KB
/
Workflow.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
% Script to perform a Qualification Plan workflow
% Qualification Plan Workflow developed with Matlab 2017b
% --------------------------------------------------------------
close all
tic
%if exist(fullfile(cd,'re_input'),'dir')>0 rmdir(fullfile(cd,'re_input'),'s'); end
%if exist(fullfile(cd,'re_output'),'dir')>0 rmdir(fullfile(cd,'re_output'),'s'); end
%if exist(fullfile(cd,'report'),'dir')>0 rmdir(fullfile(cd,'report'),'s'); end
% --------------------------------------------------------------
% replace qualificationRunnerFolder and markdownJoinerFolder with your paths
qualificationRunnerFolder = 'C:\Software\QualificationRunner_11.0.9999';
markdownJoinerFolder = 'C:\Software\markdown-joiner_1.2.0.8';
PKSimPortableFolder = 'C:\Software\PK-Sim_11.0.9999';
% --------------------------------------------------------------
% replace basisDir and qualificationPlanName with your paths
%
% assuming the following structure
% basisDir
% - input
% - qualificationPlanName
% - re_input
% - re_output
% - report
%
basisDir = fullfile(cd);
qualificationPlanName = 'Qualification-Ontogeny-CYP2C8.json';
% In case your folder structure is different from assumed above,
% qualificationPlan, REInput_path, REOutput_path and ReportOutput_path must be adjusted as well
%
% - REInput_path: input path for the Reporting engine
% (corresponds to the output path defined in the Qualification Runner)
%
% - REOutput_path: outputs of the Reporting Engine will be created here
% CAUTION: if the folder is not empty, its contents will be deleted
%
% - ReportOutput_path: final report will be generated here
qualificationPlan = fullfile(basisDir,'Input',qualificationPlanName);
REInput_path = fullfile(basisDir,'re_input');
REOutput_path = fullfile(basisDir,'re_output');
ReportOutput_path=fullfile(basisDir,'report');
% --------------------------------------------------------------
% STEP #1: start qualification runner to generate inputs for the reporting engine
startQualificationRunner(qualificationRunnerFolder, qualificationPlan, REInput_path, ['-p ' PKSimPortableFolder ' --logLevel Debug']);
% --------------------------------------------------------------
% STEP #2: start reporting engine
% Get the Configuration Plan Settings
reportConfigurationPlan = 'report-configuration-plan.json';
[WSettings, ConfigurationPlan, TaskList, ObservedDataSets] = initializeQualificationWorkflow(reportConfigurationPlan, REInput_path, REOutput_path);
%OPTIONAL: set watermark. If set, it will appear in all generated plots
WSettings.Watermark = '';
% run the Worklfow tasklist of ConfigurationPlan
runQualificationWorkflow(WSettings, ConfigurationPlan, TaskList, ObservedDataSets);
QualificationWorkflowTime = toc/60;
fprintf('\n Qualification Workflow Duration: %0.1f minutes \n', QualificationWorkflowTime);
% --------------------------------------------------------------
% STEP #3: call MarkdownJoiner to combine Reporting Engine output into the final report
MarkdownJoiner_path=fullfile(markdownJoinerFolder,'markdown-joiner.exe');
% alternative #1: ReportOutput_path must be empty. If not, report generation will fail
status = system(['"' MarkdownJoiner_path '" -i "' REOutput_path '" -o "' ReportOutput_path '"']);
% alternative #2: (CAUTION) ReportOutput_path will be cleared first
%status = system(['"' MarkdownJoiner_path '" -i "' REOutput_path '" -o "' ReportOutput_path '" -f']);
if status~=0 error('MarkdownJoiner failed'); end