%% Information about model application
% A MATLAB application from the field of systems biology was chosen for
% experimental runs. The application was created using SimBiology which
% extends MATLAB with functionality for modeling, simulating, and
% analyzing biochemical pathways.
%
% The application allows a user to model and simulate the dynamics of a
% simple gene regulation network, and understand the effect of
% stochasticity on the final state of the system. A ensemble of stochastic
% runs were performed on a gene-regulation model, and the distribution of
% state was studied at any given time point. Several hundred thousand
% simulations might need to be performed to obtain a smooth probability
% distribution function, requiring several days of computation on one
% MATLAB.
% The model used in this script was adpated from the following publication :
% Kepler TB, Elston TC. Stochasticity in transcriptional regulation:
% Origins, consequences and % mathematical representations. Biophys J.
% 2001;81:31163136.
clear all
%% Submitting Parallel Version Using Jobs and Task
numberOfRuns = 20;
noWorkers = 2;
%% Creating Job and associated Tasks
% Number of tasks per worker
runsPerWorkers = ones(noWorkers,1).*floor(numberOfRuns/noWorkers) ;
runsPerWorkers(end) = numberOfRuns - sum(runsPerWorkers(1:end-1));
% Create job
job = createJob(); % uses defaultParallelConfig
% Create tasks for job, distributing runs across workers
for i=1:noWorkers
createTask(job, @sbiosimulate_wrapper, 1, {runsPerWorkers});
end
%% Submitting Job
disp('Submitting job ...');
submit(job)
disp('Waiting for job ...');
waitForState(job,'finished') % optional to wait
disp('Job Finished');
%% Collect Results from Job
output = getAllOutputArguments(job); % Get output arguments
histData = cell2mat(output); % Combine output to get data for histogram
% Plot results
hist(histData(:,1))
title('Histogram of protein state at t = 1000 s')
xlabel('Protein State')
ylabel('Frequency')
%% Destroy job when finished
destroy(job)