Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 6 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# This is a basic workflow to help you get started with MATLAB Actions
name: MATLAB Build
name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events, but only for the main branch
push:
branches: [ main ]
# Triggers the workflow on pull request events, but only for the main branch
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
PRODUCT_LIST: MATLAB MATLAB_Test
PRODUCT_LIST: MATLAB MATLAB_Test SimBiology Statistics_and_Machine_Learning_Toolbox

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
Expand All @@ -24,20 +22,15 @@ permissions:
# Only allow one build of this type to run at a time
# Ensure results publishing completes without being interrupted/overwritten
concurrency:
group: "test and publish results"
group: "test"
cancel-in-progress: false

jobs:
# This workflow contains a single job called "build"
build:

# Set up URLs for GitHub Pages report
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
test:

# The type of runner that the job will run on
runs-on: ubuntu-latest
runs-on: windows-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -57,36 +50,3 @@ jobs:
uses: matlab-actions/run-build@v2
with:
tasks: test

# Configure GitHub Pages to accept your artifact uploads
- name: Setup Pages
uses: actions/configure-pages@v5

# Upload testing and code coverage reports to your repository
- name: Upload pages
uses: actions/upload-pages-artifact@v4
with:
path: results # Upload results

# Publish reports to GitHub Pages so they can be viewed in a browser
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4



# ==================================== #
# Alternate ways to run commands in CI #
# ==================================== #

## Runs your tests using `runtests` command
#- name: Run all tests
# uses: matlab-actions/run-tests@v2
# with:
# source-folder: code

## Executes custom MATLAB scripts, functions, or statements
#- name: Run custom testing procedure
# uses: matlab-actions/run-command@v2
# with:
# command: disp('Running my custom testing procedure!'); addpath('code'); results = runtests('IncludeSubfolders', true); assertSuccess(results);
99 changes: 99 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# This is a basic workflow to help you get started with MATLAB Actions
name: MATLAB Build

# Controls when the action will run.
on:
# Triggers the workflow on push events, but only for the main branch
push:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
PRODUCT_LIST: MATLAB MATLAB_Test SimBiology Statistics_and_Machine_Learning_Toolbox

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Only allow one build of this type to run at a time
# Ensure results publishing completes without being interrupted/overwritten
concurrency:
group: "test and publish results"
cancel-in-progress: false

jobs:

build:

# Set up URLs for GitHub Pages report
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# The type of runner that the job will run on
runs-on: windows-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:

# Check out your repository
- uses: actions/checkout@v5

# Set up MATLAB on a GitHub-hosted runner
- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v2
with:
products: ${{ env.PRODUCT_LIST }}
cache: true

# Run the MATLAB build tool to build and test your code
- name: Run buildtool
uses: matlab-actions/run-build@v2
with:
tasks: test

# Configure GitHub Pages to accept your artifact uploads
- name: Setup Pages
if: always()
uses: actions/configure-pages@v5

# Upload testing and code coverage reports to your repository
- name: Upload pages
if: always()
uses: actions/upload-pages-artifact@v4
with:
path: results # Upload results

# # Upload compiled CTF file to deploy Web App
# - name: Upload CTF file
# uses: actions/upload-pages-artifact@v4
# with:
# name: WebApp_CTF
# path: WebAppArchive/*.ctf

# Publish reports to GitHub Pages so they can be viewed in a browser
- name: Deploy to GitHub Pages
id: deployment
if: always()
uses: actions/deploy-pages@v4


# ==================================== #
# Alternate ways to run commands in CI #
# ==================================== #

## Runs your tests using `runtests` command
#- name: Run all tests
# uses: matlab-actions/run-tests@v2
# with:
# source-folder: code

## Executes custom MATLAB scripts, functions, or statements
#- name: Run custom testing procedure
# uses: matlab-actions/run-command@v2
# with:
# command: disp('Running my custom testing procedure!'); addpath('code'); results = runtests('IncludeSubfolders', true); assertSuccess(results);
7 changes: 3 additions & 4 deletions buildfile.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
% CodeIssues task
plan("check") = CodeIssuesTask(Results=["results/codeissues.sarif"; ...
"results/codeissues.mat"]);

% Test task
tTask = TestTask("tests", ...
SourceFiles = "code", ...
Expand All @@ -34,7 +33,7 @@
plan("generateSimFun").Inputs = fullfile(proj.RootFolder,"code","*.sbproj");
plan("generateSimFun").Outputs = fullfile(proj.RootFolder,"code","*.mat");
plan("test").Inputs = fullfile(proj.RootFolder,"code","*");
plan("compile").Inputs = fullfile(proj.RootFolder,"code",["*.mat","*.mlapp","graystyle.m"]);
plan("compile").Inputs = fullfile(proj.RootFolder,"code",["*.mat","*.mlapp","*.m"]);
plan("compile").Outputs = fullfile(proj.RootFolder,"WebAppArchive");

% Set default task
Expand Down Expand Up @@ -62,9 +61,9 @@ function compileTask(~)

MATfilename = dir(fullfile(rootFolder,"code","*.mat"));
MATfilename = fullfile(rootFolder,"code",MATfilename.name);
load(MATfilename,"dependenciesSimFun");
s = load(MATfilename,"dependenciesSimFun");

appDependencies = [MATfilename; dependenciesSimFun; ...
appDependencies = [MATfilename; s.dependenciesSimFun; ...
codeFiles; imgFiles];
appfilename = fullfile(rootFolder,"code","TMDDApp.mlapp");

Expand Down
20 changes: 13 additions & 7 deletions code/ConcTimecourseView.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@

properties ( Access = private )
Model
Axes

ConcColors = [0.30,0.75,0.93;...
0.86,0.55,0.41;...
0.91,0.73,0.42]; % colors to plot concentrations
FontName = "Helvetica";
end

properties ( SetAccess=private, GetAccess={?tTMDDApp} )
properties ( Hidden )
% Leave these properties Hidden but public to enable access for any test generated
% with Copilot during workshop
Axes

% line handles
lhDrug
lhReceptor
Expand All @@ -35,13 +38,16 @@
xlabel(ax, "Time (hours)", 'FontName',obj.FontName);
ylabel(ax, "Concentrations (nanomole/liter)",'FontName',obj.FontName);

obj.lhDrug = plot(ax, NaN, NaN, '-','Linewidth',2,'Color',obj.ConcColors(1,:));
obj.lhDrug = plot(ax, NaN, NaN, '-','Linewidth',2,'Color',obj.ConcColors(1,:),'DisplayName','Drug');
hold(ax,'on');
obj.lhReceptor = plot(ax, NaN, NaN, '-','Linewidth',2,'Color',obj.ConcColors(2,:));
obj.lhComplex= plot(ax, NaN, NaN, '-','Linewidth',2,'Color',obj.ConcColors(3,:));
obj.lhReceptor = plot(ax, NaN, NaN, '-','Linewidth',2,'Color',obj.ConcColors(2,:),'DisplayName','Receptor');
obj.lhComplex= plot(ax, NaN, NaN, '-','Linewidth',2,'Color',obj.ConcColors(3,:),'DisplayName','Complex');
hold(ax,'off');
lh = legend(ax,{'Drug','Receptor','Complex'},'FontName',obj.FontName);
lh.Box = 'off';
lgd = legend(ax,'show','FontName',obj.FontName,'Color','none');
lgd.Box = "off";

ax.XLimitMethod = "padded";
ax.YLimitMethod = "padded";

% instantiate listener
dataListener = event.listener( model, 'DataChanged', ...
Expand Down
4 changes: 3 additions & 1 deletion code/LampView.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
LampColorFailure = [0.85, 0.33, 0.10] % color of lamp if RO not between thresholds after day 1
end

properties ( SetAccess=private, GetAccess={?tTMDDApp} )
properties ( Hidden )
% Leave these properties Hidden but public to enable access for any test generated
% with Copilot during workshop
LampObj
end

Expand Down
4 changes: 3 additions & 1 deletion code/NCAView.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

end

properties ( SetAccess=private, GetAccess={?tTMDDApp} )
properties ( Hidden )
% Leave these properties Hidden but public to enable access for any test generated
% with Copilot during workshop
NCAtable
end

Expand Down
11 changes: 7 additions & 4 deletions code/ROTimecourseView.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
'FontWeight','bold','LabelVerticalAlignment','middle'}; % style for threshold lines
end

properties ( GetAccess = {?tTMDDApp} )
properties ( Hidden, SetAccess=private)
% Leave these properties Hidden but public to enable access for any test generated
% with Copilot during workshop

% line handles
lhRO
end
Expand Down Expand Up @@ -39,12 +42,12 @@
ylabel(ax, "RO (%)",'FontName',obj.FontName);

obj.lhRO = plot(ax, NaN, NaN, 'Color', obj.ROColors,'Linewidth',2);
yline(ax,model.ThresholdValues(1), '--','efficacy','FontName',obj.FontName,obj.ThresholdStyle{:});
yline(ax,model.ThresholdValues(2), '--','safety','FontName',obj.FontName,obj.ThresholdStyle{:});
% yline(ax,model.ThresholdValues(1), '--','efficacy','FontName',obj.FontName,obj.ThresholdStyle{:});
% yline(ax,model.ThresholdValues(2), '--','safety','FontName',obj.FontName,obj.ThresholdStyle{:});


% set limits
xlim(ax,'auto');
ax.XLimitMethod = "padded";
ylim(ax,[-5, 105]);

% instantiate listener
Expand Down
42 changes: 26 additions & 16 deletions code/SimulationModel.m
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
classdef SimulationModel < handle
% Class to simulate the TMDD model

properties ( SetAccess = private )
DoseTable % daily dose to apply to simulate
SimFun % exported SimFunction

SimData
SimDataTable

ThresholdValues = [20, 80] % threshold values

end

properties
% original values for resetting
Amount0 (1,1) double
Expand All @@ -20,10 +9,28 @@
Kel0 (1,1) double
Kdeg0 (1,1) double
Interval0 (1,1) double
end

properties ( Dependent )
ROIsBetweenThresholds (1,1) logical
end

events ( NotifyAccess = private )
properties ( Hidden )
% Leave these properties Hidden but public to enable access for any test generated
% with Copilot during workshop

DoseTable % daily dose to apply to simulate
SimFun % exported SimFunction

SimDataTable
SimData

ThresholdValues = [20, 80] % threshold values
end

events ( NotifyAccess = public )
% Leave this notification public to enable access for any test generated
% with Copilot during workshop
DataChanged
end

Expand Down Expand Up @@ -73,10 +80,6 @@ function simulate(obj, parameters)
idxNotIncreasing = diff(t.Time)<=0; % remove duplicates
t(idxNotIncreasing,:) = [];

% logical value to check whether or not RO remains between thresholds after day 1
aboveThreshold1 = all(t.RO(t.Time >= 24) >= obj.ThresholdValues(1)/100);
belowThreshold2 = all(t.RO(t.Time >= 24) <= obj.ThresholdValues(2)/100);
obj.ROIsBetweenThresholds = aboveThreshold1 && belowThreshold2;

obj.SimData = sd;
obj.SimDataTable = t;
Expand All @@ -85,6 +88,13 @@ function simulate(obj, parameters)

end % simulate

function value = get.ROIsBetweenThresholds(obj)
% logical value to check whether or not RO remains between thresholds after day 1
timeAfter24h = obj.SimDataTable.Time >= 24;
ROAfter24h = obj.SimDataTable.RO(timeAfter24h);
value = all(ROAfter24h >= obj.ThresholdValues(1)/100) && ...
all(ROAfter24h <= obj.ThresholdValues(2)/100);
end % get.ROIsBetweenThresholds()

end % public methods

Expand Down
Binary file modified code/TMDD.sbproj
Binary file not shown.
Binary file removed code/simFunction_Dose.mat
Binary file not shown.
Loading