EXPERIMENTAL MODEL
We wanted a way to determine the number of our sensor bacteria required in the starter culture of a given cheese in order to ensure an accurate detection of Listeria contamination. To do this we modelled the rate of up-regulation of the agr operon in Listeria and predicted the responsiveness of our sensor.
This model is based on equations derived from https://link.springer.com/content/pdf/10.1007%2Fs00285-009-0291-6.pdf . We assumed that equations that govern the up-regulation of the agr operon in Staphylococcus would be similar to those applicable in Listeria, and so we used symbiology functions to create a step-by-step sequence of agr regulation based on the Staphylococcus template. Each step was defined as a reaction, and each reaction was governed by a kinetic law, i.e. a differential equation defining that step in the regulatory process.
Each reaction and its associated equation are shown below, see the end of this article for a table defining each variable AND IT'S UNITS.
Two compartments were generated in symbiology, one for Listeria (called cell), and one for our sensing bacteria (called sensor).
For our Listeria compartment we modelled the following reactions:
1. DNA -> mRNA -> AgrA, AgrB, AgrC, AgrD
The above image shows the equations used to model transcription and translation of the agr operon. Whilst transcription of the agr components was assumed to occur at an equal rate, given that they are all components of the same operon regulated by one upstream promoter, each component of the agr system was assigned a unique rate equation to define its translation rate, and these are given below;
Highlighted here, in blue, is the equation used to describe the agr operon transcription. The equation format is as follow:
Note: the comma in the highlighted section represents an equals sign, and this format is used for all subsequent equations.
All terms are defined in an Abbreviation's table (see below).
agrB translation
agrD translation
agrA translation
agrC translation
2. Rate of AgrB integration into the membrane after AIP stimulus (TB)
3. Rate of AgrD association with transmembrane B after AIP stimulus
4.Rate of AgrC integration into the membrane after AIP stimulus
5. Rate of increase in the extracellular AIP concentration
6. AIP interaction with transmembrane AgrC
7. Rate of AgrA phosphorylation after AIP stimulus
8. Rate of interaction of Phosphorylated AgrA with the promoter for the agr operon (PII)
For the sensor, we used the following additional considerations
1. The movement of AIP through the cheese and subsequent sensor AgrC binding
Using a modified Stokes-Einstein equation, we aimed to estimate the rate of diffusion through cheese, depending on a number of important biophysical cheese properties. If we assume cheese can be represented as a porous matrix, in which the “pores” are fairly large (i.e. there is space for molecules to diffuse), then we can use Fick’s diffusion to describe mass transfer between these pores. This can be done by multiplying the diffusion coefficient (calculated using the Stokes-Einstein equation) by x/y (where x is equal to the tortuosity and y is equal to the porosity of the medium). The tortuosity of a medium (in our case cheese) can be described as the difficulty a molecule encounters when trying to move through the medium, whereas the porosity can be described as the ease a molecule encounters when moving through a medium. We, therefore, decided to assign the value of x (tortuosity) as a variable describing the total amount of fat, protein, and salt within the cheese (in other words, the dry mass of the cheese), as these are all the kind of molecules that AIP would encounter as obstacles to free diffusion, and thus they represent “difficulty”. For the value of y (porosity), we assigned a variable describing the water content in the cheese (in other words, the total weight of the cheese minus its dry mass), as we theorised AIP would encounter less difficulty moving through a cheese with a higher water content.
The resulting equation is as follows:
2. AgrA phosphorylation by our sensor AgrC upon AIP binding
3. Phosphorylated AgrA stimulated transcription of amilCP
Results and Discussion
Above is an image of the graph generated when our model is simulated in MatLab. Each line corresponds to an important component in the mechanism of agr upregulation in Listeria. For the proof-of-concept simulations random values were assigned to the parameters. However, so model was set up in such a way that we could have used an ensemble modelling approach by collecting possible values from sources like Bionumbers and creating a probability distribution for each parameter. These distributions could then have been used to conduct a Bayesian analysis for plausible predictions, including confidence intervals. We would have also liked to create a user input function, to allow a user to define the properties of their specific cheese. Most importantly, cheese types vary widely in water content, and our discussions with cheese makers had shown us that this is a very important consideration for Listeria detection. By exploring the effect of different biophysical condition, our model would thus allow us to determine an accurate prediction of the concentration of our sensor bacteria required for reliable Listeria detection in a user-specific starting culture. This again is an important feature of our project, requested by cheese makers in our stakeholder discussions with various companies (read more in our Human practices page).
Abbreviation's Table
Experimental model code
function varargout = promoteranalysisgui(varargin)
% PROMOTERANALYSISGUI MATLAB code for promoteranalysisgui.fig
% PROMOTERANALYSISGUI, by itself, creates a new PROMOTERANALYSISGUI or raises the existing
% singleton*.
%
% H = PROMOTERANALYSISGUI returns the handle to a new PROMOTERANALYSISGUI or the handle to
% the existing singleton*.
%
% PROMOTERANALYSISGUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in PROMOTERANALYSISGUI.M with the given input arguments.
%
% PROMOTERANALYSISGUI('Property','Value',...) creates a new PROMOTERANALYSISGUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before promoteranalysisgui_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to promoteranalysisgui_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help promoteranalysisgui
% Last Modified by GUIDE v2.5 11-Sep-2018 14:21:33
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @promoteranalysisgui_OpeningFcn, ...
'gui_OutputFcn', @promoteranalysisgui_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before promoteranalysisgui is made visible.
function promoteranalysisgui_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to promoteranalysisgui (see VARARGIN)
% Choose default command line output for promoteranalysisgui
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes promoteranalysisgui wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% UPDATE DROP DOWN MENUS:
set(handles.figure1, 'units', 'normalized', 'position', [0 0 1 1])
[~,CPactivityletters,CPactivity] = xlsread('Cpactivity.xlsx');
CPactivity(1,:) = [];
bacterianames = CPactivityletters(1,61 : end)';
set(handles.popupmenu1,'String',bacterianames);
set(handles.popupmenu2,'String',bacterianames);
% --- Outputs from this function are returned to the command line.
function varargout = promoteranalysisgui_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[~,CPactivityletters,CPactivity] = xlsread('Cpactivity.xlsx');
CPactivity(1,:) = [];
bacterianames = CPactivityletters(1,61 : end)';
activities = cell2mat(CPactivity(:,61 : end));
bacteria1choice = get(handles.popupmenu1,'Value')
bacteria2choice = get(handles.popupmenu2,'Value')
bacteria1name = bacterianames {bacteria1choice};
bacteria2name = bacterianames {bacteria2choice};
bacteria1column = find(strcmp(CPactivityletters(1,61 : end),bacteria1name));
bacteria2column = find(strcmp(CPactivityletters(1,61 : end),bacteria2name));
bacteria1activity = activities(:,bacteria1column);
bacteria2activity = activities(:,bacteria2column);
nucleotides = {'A', 'C', 'G', 'T', '-'};
CPactivityletters(1,:) = [];
m = size(CPactivity); % Done to achieve a matrix of "37" "62"
W = m(2);
L = m(1); % Used to select the 37 from the above matrix
occurences = zeros(L,W-2); % Generates a empty matrix, which can be used to store the commanality of the nucleotide at this position (ie - in this column) as a value between 0 and 1
for k = 1 : 60
for j = 1 : length(nucleotides)
occurences (j,k) = sum((double(strcmp(CPactivity(1:end,k), nucleotides{1,j}))) == 1)/L;
end
end
for q = 1 : 60
for r = 1 : L
if double(strcmp( CPactivity{r,q}, 'A')) == 1
CPactivity{r,q} = occurences(1,q);
elseif double(strcmp( CPactivity{r,q}, 'C')) == 1
CPactivity{r,q} = occurences(2,q);
elseif double(strcmp( CPactivity{r,q}, 'G')) == 1
CPactivity{r,q} = occurences(3,q);
elseif double(strcmp( CPactivity{r,q}, 'T')) == 1
CPactivity{r,q} = occurences(4,q);
else
CPactivity{r,q} = occurences(5,q);
end
end
end
CPactivity = cell2mat(CPactivity);
tablepositionx = zeros (L,L); %tablepositionx is the collection of changing probablilities (in relation to the likelihood of it causing change in activity) between sequences at position x L = number of rows
averageactivitychange = zeros (L,W-2);
for p = 1 : 60
for b = 1 : L % loop through the rows one by one
for a = 1 : L
tablepositionx(b,a) = abs(CPactivity(b,p)-CPactivity(a,p))/(sum(abs(CPactivity(b,1:end-2) - CPactivity(a,1:end-2))));
end
end
for t = 1 : L
averageactivitychange(t,p) = nanmean(tablepositionx(t,:)); % I want to be able to chose the mean of only the fully filled rows
end
end
[row,col] = find(averageactivitychange==0);
figure (1)
scatter(CPactivity(1:end,61),CPactivity(1:end,62),'x');
lsline
datacursormode on
grid on
title (['Activity in ' bacteria1name ' vs.' bacteria2name '.'])
xlabel (['Activity in' bacteria1name '.'])
ylabel (['Activity in' bacteria2name '.'])
pause
[xclicks,yclicks] = ginput;
c = length(xclicks);
sequencesofinterest = cell(c, W+1);
for d = 1 : c
[~,index] = min((CPactivity(:,61)-xclicks(d,1)).^2+(CPactivity(:,62)-yclicks(d,1)).^2);
sequencesofinterest{d,1} = index;
sequencesofinterest(d,2:3) = num2cell(CPactivity(index,W-1 : W));
sequencesofinterest(d,4:end) = CPactivityletters(index,1:W-2);
end
set(handles.uitable2,'data',sequencesofinterest)
figure (2)
title (['Activity changes in' bacteria1name 'and' bacteria2name '.'])
imagesc(averageactivitychange);
colorbar
hold on
g_y=[0.5:1:L + 0.5]; % user defined grid Y [start:spaces:end]
g_x=[0.5:1:(W-2) + 0.5]; % user defined grid X [start:spaces:end]
for i=1:length(g_x)
plot([g_x(i) g_x(i)],[g_y(1) g_y(end)],'k') %y grid lines
hold on
end
for i=1:length(g_y)
plot([g_x(1) g_x(end)],[g_y(i) g_y(i)],'k') %x grid lines
hold on
end
set(gca,'xtick', linspace(1,W-2,floor((W-2)/5)+2), 'ytick', linspace(1,L,floor(L/5)));
activitychangebacteria1 = zeros(L,W-2);
activitychangebacteria2 = zeros(L,W-2);
for a = 1 : L
activitychangebacteria1 (a,1:end) = averageactivitychange(a,1:end) * CPactivity(a,61);
activitychangebacteria2 (a,1:end) = averageactivitychange(a,1:end) * CPactivity(a,62);
end
% Calculate mean activity change per column for each bacteria:
averageactivitychangebacteria1 = mean(activitychangebacteria1);
averageactivitychangebacteria2 = mean(activitychangebacteria2);
% Calculate difference between activity changes and mean activity change per column
for i = 1 : W-2
activitychangebacteria1(1:end,i) = activitychangebacteria1(1:end,i) - averageactivitychangebacteria1(1,i);
activitychangebacteria2(1:end,i) = activitychangebacteria2(1:end,i) - averageactivitychangebacteria2(1,i);
end
% looping though each column to calculate average activity of each letter:
activityperbasebacteria1 = zeros (5,W-2); % Activity per base created - 5 x 60 matrix
activityperbasebacteria2 = zeros (5,W-2); % Activity per base created - 5 x 60 matrix
for r = 1 : W-2
% if no average activity change is detected for column r then set all of activityperbasebacteria1(:,r) to 0
if averageactivitychangebacteria1(:,r) == 0
activityperbasebacteria1(:,r) = 0;
end
if averageactivitychangebacteria2(:,r) == 0
activityperbasebacteria2(:,r) = 0;
end
% Find the row numbers (INDICES) where the 5 bases appear:
idxA = find(strcmp(CPactivityletters(:,r),'A') == 1);
idxC = find(strcmp(CPactivityletters(:,r),'C') == 1);
idxG = find(strcmp(CPactivityletters(:,r),'G') == 1);
idxT = find(strcmp(CPactivityletters(:,r),'T') == 1);
idxdash = find(strcmp(CPactivityletters(:,r),'-') == 1);
if isempty(idxA) == 1 || length(idxA) == 1
activityperbasebacteria1(1,r) = 0;
activityperbasebacteria2(1,r) = 0;
else
activityperbasebacteria1(1,r) = mean(activitychangebacteria1(idxA,r));
activityperbasebacteria2(1,r) = mean(activitychangebacteria2(idxA,r));
end
if isempty(idxC) == 1 || length(idxC) == 1
activityperbasebacteria1(2,r) = 0;
activityperbasebacteria2(2,r) = 0;
else
activityperbasebacteria1(2,r) = mean(activitychangebacteria1(idxC,r));
activityperbasebacteria2(2,r) = mean(activitychangebacteria2(idxC,r));
end
if isempty(idxG) == 1 || length(idxG) == 1
activityperbasebacteria1(3,r) = 0;
activityperbasebacteria2(3,r) = 0;
else
activityperbasebacteria1(3,r) = mean(activitychangebacteria1(idxG,r));
activityperbasebacteria2(3,r) = mean(activitychangebacteria2(idxG,r));
end
if isempty(idxT) == 1 || length(idxT) == 1
activityperbasebacteria1(4,r) = 0;
activityperbasebacteria2(4,r) = 0;
else
activityperbasebacteria1(4,r) = mean(activitychangebacteria1(idxT,r));
activityperbasebacteria2(4,r) = mean(activitychangebacteria2(idxT,r));
end
if isempty(idxdash) == 1 || length(idxdash) == 1
activityperbasebacteria1(5,r) = 0;
activityperbasebacteria2(5,r) = 0;
else
activityperbasebacteria1(5,r) = mean(activitychangebacteria1(idxdash,r));
activityperbasebacteria2(5,r) = mean(activitychangebacteria2(idxdash,r));
end
end
STATS STUFF:
chibacteria1 = zeros(5,60);
for a = 1 : 60
for b = 1 : 5
if activityperbasebacteria1(:,a) == 1 % do fucking nothing
else
if activityperbasebacteria1 (b,a) == 0
chibacteria1(b,a) = 0;
else
meanofcolumn = mean(activityperbasebacteria1(find(activityperbasebacteria1(:,a)~=0),a));
chibacteria1(b,a) = ((activityperbasebacteria1(b,a) - meanofcolumn) .^ 2)/ meanofcolumn;
end
end
end
end
siglev1 = zeros(5,60);
for b = 1 : 5
for a = 1 : 60
for i = chibacteria1(b,a)
if chibacteria1(b,a) == 0
else
siglev1(b,a) = 1 - chi2cdf(i,nnz(chibacteria1(:,a))-1);
end
end
end
end
% the above gives the significance level to which you can trust the result
% REPEAT FOR BACTERIA 2:
chibacteria2 = zeros(5,60);
for a = 1 : 60
for b = 1 : 5
if activityperbasebacteria2(:,a) == 1 % do fucking nothing
else
if activityperbasebacteria2 (b,a) == 0
chibacteria2(b,a) = 0;
else
meanofcolumn = mean(activityperbasebacteria2(find(activityperbasebacteria2(:,a)~=0),a));
chibacteria2(b,a) = ((activityperbasebacteria2(b,a) - meanofcolumn) .^ 2)/ meanofcolumn;
end
end
end
end
siglev2 = zeros(5,60);
for b = 1 : 5
for a = 1 : 60
for i = chibacteria2(b,a)
if chibacteria2(b,a) == 0
else
siglev2(b,a) = 1 - chi2cdf(i,nnz(chibacteria2(:,a))-1);
end
end
end
end
siglevbacteriacombine = zeros(11,60);
siglevbacteriacombine(1:5,1:60) = siglev1;
siglevbacteriacombine(6,1:60) = 2;
siglevbacteriacombine(7:11,1:60) = siglev2;
siglevbacteriacombine(siglevbacteriacombine == 0) = NaN;
[h,p] = ttest(siglev1,siglev2);
p(isnan(p))=1;
pstring = num2cell(p);
PLOT STUFF:
axes(handles.axes1);
imagesc(siglevbacteriacombine(1:5,1:60),'AlphaData',~isnan((siglevbacteriacombine(1:5,1:60))));
colorbar
hold on
for i=1:length(g_x)
plot([g_x(i) g_x(i)],[g_y(1) g_y(end)],'k') %y grid lines
hold on
end
for i=1:length(g_y)
plot([g_x(1) g_x(end)],[g_y(i) g_y(i)],'k') %x grid lines
hold on
end
set(gca,'xtick', linspace(5,W-2,(W-2) / 5), 'ytick', linspace(1,L,L));
axes(handles.axes2)
imagesc(siglevbacteriacombine(7:11,1:60),'AlphaData',~isnan((siglevbacteriacombine(7:11,1:60))));
colorbar
hold on
for i=1:length(g_x)
plot([g_x(i) g_x(i)],[g_y(1) g_y(end)],'k') %y grid lines
hold on
end
for i=1:length(g_y)
plot([g_x(1) g_x(end)],[g_y(i) g_y(i)],'k') %x grid lines
hold on
end
set(gca,'xtick', linspace(5,W-2,(W-2)/5), 'ytick', linspace(1,L,L));
USER INPUT BOX TO GATHER HOW MANY BASES USER WILL SELECT:
% prompt = {'Enter number of bases to select for bacteria 1:','Enter number of bases to select for bacteria 2:'};
% titlebox ='Base Selection';
% dims = [1 35];
% answer = inputdlg(prompt,titlebox,dims);
% numberbasestoselectbacteria1 = str2num (answer{1,1});
% numberbasestoselectbacteria2 = str2num (answer{2,1});
% %% THIS IS ALL THE CRAP WHERE YOU CAN SELECT BOTH HEAT MAPS AT THE SAME TIME AND THE USER DOESNT HAVE TO KNOW HOW MANY LETTERS TO SELECT:
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% positionaxes1 = get(handles.axes1, 'Position');
%
% axes1x1 = positionaxes1(1);
% axes1y1 = positionaxes1(2);
% axes1width = positionaxes1(3);
% axes1height = positionaxes1(4);
%
%
% % Gather coordinates for 4 corners of axes 1 and 2:
%
% axes1x2 = axes1x1 + axes1width;
% axes1y2 = axes1y1 + axes1height;
%
%
% positionaxes2 = get(handles.axes2, 'Position');
%
% axes2x1 = positionaxes2(1);
% axes2y1 = positionaxes2(2);
% axes2width = positionaxes2(3);
% axes2height = positionaxes2(4);
%
%
% axes2x2 = axes2x1 + axes2width;
% axes2y2 = axes2y1 + axes2height;
%
% %
% %
% % w = 0;
% %
% %
% % while (w == 0)
% %
% % for a = 1 : 1000
% %
% %
% %
% % Get current location of mouse
% %
% % set (gcf, 'WindowButtonMotionFcn', @mouseMove);
% %
% % c = get (gca, 'CurrentPoint');
% %
% % x = c(1,1);
% %
% % y = c(1,2);
% %
% %
% %
% %
% %
% [x(a),y(a),button(a)] = ginput(1); % get points the user clicked
%
% generalpoints(a,1:2) = get(handles.figure1, 'currentpoint');
%
% generalx = generalpoints(a,1);
%
% generaly = generalpoints(a,2);
%
% % end
% %
% %
% %
%
%
% if generalx <= axes1x2 && generalx >= axes1x1 && generaly <= axes1y2 && generaly >= axes1y1
%
% bacteria1x = ceil (x(a)-0.5);
%
% bacteria1y = ceil (y(a)-0.5);
%
% k = 1;
%
%
% if button(a) == 1 && k == 1
%
% bacteria1letters (1,bacteria1x) = activityperbasebacteria1(bacteria1y, bacteria1x);
%
% %
% %
% % elseif button(a) == 3 && k == 1
% %
% % activitybacteria1 = activityperbasebacteria1(bacteria1y, bacteria1x);
% %
% set(handles.text14, 'String', bacteria1letters (1,bacteria1x))
% %
% %
% end
% %
% %
% %
% elseif generalx <= axes2x2 && generalx >= axes2x1 && generaly <= axes2y2 && generaly >= axes2y1
%
% bacteria2x = ceil (x(a)-0.5);
%
% bacteria2y = ceil (y(a)-0.5);
%
% k = 2;
%
%
% if button(a) == 1 && k == 2
%
% bacteria2letters(1,bacteria2x) = activityperbasebacteria2(bacteria2y, bacteria2x);
%
%
% % elseif button(a) == 3 && k == 2
% %
% % activitybacteria2 = activityperbasebacteria2(bacteria2y, bacteria2x);
% %
% set(handles.text15, 'String', bacteria2letters(1,bacteria2x))
%
% %
%
% end
% %
% end
%
% %
% % end
% %
% % end
activitybacteria1 = zeros(5,60);
activitybacteria2 = zeros(5,50);
% positionaxes1 = get(handles.axes1, 'Position');
%
% axes1x1 = positionaxes1(1);
% axes1y1 = positionaxes1(2);
% axes1width = positionaxes1(3);
% axes1height = positionaxes1(4);
%
%
% % Gather coordinates for 4 corners of axes 1 and 2:
%
% axes1x2 = axes1x1 + axes1width;
% axes1y2 = axes1y1 + axes1height;
%
%
% positionaxes2 = get(handles.axes2, 'Position');
%
% axes2x1 = positionaxes2(1);
% axes2y1 = positionaxes2(2);
% axes2width = positionaxes2(3);
% axes2height = positionaxes2(4);
%
%
% axes2x2 = axes2x1 + axes2width;
% axes2y2 = axes2y1 + axes2height;
w = 0;
while (w == 0)
positionaxes1 = get(handles.axes1, 'Position');
axes1x1 = positionaxes1(1);
axes1y1 = positionaxes1(2);
axes1width = positionaxes1(3);
axes1height = positionaxes1(4);
% Gather coordinates for 4 corners of axes 1 and 2:
axes1x2 = axes1x1 + axes1width;
axes1y2 = axes1y1 + axes1height;
positionaxes2 = get(handles.axes2, 'Position');
axes2x1 = positionaxes2(1);
axes2y1 = positionaxes2(2);
axes2width = positionaxes2(3);
axes2height = positionaxes2(4);
axes2x2 = axes2x1 + axes2width;
axes2y2 = axes2y1 + axes2height;
for a = 1 : 1000
c = get (gca, 'CurrentPoint');
x = c(1,1);
y = c(1,2);
hold on
[x(a),y(a),button(a)] = ginput(1); % get points the user clicked
generalpoints(a,1:2) = get(handles.figure1, 'currentpoint');
generalx = generalpoints(a,1);
generaly = generalpoints(a,2);
if generalx <= axes1x2 && generalx >= axes1x1 && generaly <= axes1y2 && generaly >= axes1y1
bacteria1x = ceil (x(a)-0.5);
bacteria1y = ceil (y(a)-0.5);
k = 1;
if button(a) == 3 && k == 1
activitybacteria1(bacteria1y,bacteria1x) = activityperbasebacteria1(bacteria1y, bacteria1x);
set(handles.text14, 'String', activitybacteria1 (bacteria1y,bacteria1x))
end
elseif generalx <= axes2x2 && generalx >= axes2x1 && generaly <= axes2y2 && generaly >= axes2y1
bacteria2x = ceil (x(a)-0.5);
bacteria2y = ceil (y(a)-0.5);
k = 2;
if button(a) == 3 && k == 2
activitybacteria2(bacteria2y,bacteria2x) = activityperbasebacteria2(bacteria2y, bacteria2x);
set(handles.text15, 'String', activitybacteria2(bacteria2y,bacteria2x))
else
end
end
end
hold off
end
%
% while (w==1)
%
% c = get (gca, 'CurrentPoint');
%
% x = c(1,1);
%
% y = c(1,2);
% transnucleotide = nucleotides';
% undernucleotide = repelem(transnucleotide,[1],[60]);
%
%
% bacteria1letters = cell(1,60);
%
% bacteria2letters = cell(1,60);
%
% [x1,y1] = ginput(60);
%
% [x2,y2] = ginput(60);
%
% % [x1,y1] = ginput(numberbasestoselectbacteria1);
% %
% % [x2,y2] = ginput(numberbasestoselectbacteria2);
%
%
% bacteria1x = ceil (x1-0.5);
%
% bacteria1y = ceil (y1-0.5);
%
%
%
% for m = 1 : length(bacteria1x)
%
% bacteria1letters{1,bacteria1x(m)} = undernucleotide{bacteria1y(m),bacteria1x(m)};
%
% end
%
%
%
%
% bacteria1empty = find(cellfun('isempty',bacteria1letters)); % find empty cells
%
% bacteria1letters(bacteria1empty) = {'NA'};
%
% bacteria1sequence = strjoin(string (bacteria1letters));
%
%
% %%%%%%%%
%
%
% bacteria2x = ceil (x2-0.5);
%
% bacteria2y = ceil (y2-0.5);
%
%
%
% for n = 1 : length(bacteria2x)
%
% bacteria2letters{1,bacteria2x(n)} = undernucleotide{bacteria2y(n),bacteria2x(n)};
%
% end
%
%
%
%
% bacteria2empty = find(cellfun('isempty',bacteria2letters)); % find empty cells
%
% bacteria2letters(bacteria2empty) = {'NA'};
%
% bacteria2sequence = strjoin(string (bacteria2letters));
%
%
% % Create a new variable "sequencesandpvalues" that contains
% % user selected sequences and p values:
%
% sequencesandpvalues = cell(3,60);
%
% sequencesandpvalues(1,:) = bacteria1letters
% sequencesandpvalues(2,:) = bacteria2letters
% sequencesandpvalues(3,:) = pstring;
%
%
% set(handles.uitable3, 'data', sequencesandpvalues)
% end
% end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LET USER SELECT BASES WHOSE ACTIVITIES THEY WANT TO INVESTIGATE:
% select for 1st heat map for bacteria 1:
w=1;
while (w==1)
positionaxes1 = get(handles.axes1, 'Position');
axes1x1 = positionaxes1(1);
axes1y1 = positionaxes1(2);
axes1width = positionaxes1(3);
axes1height = positionaxes1(4);
% Gather coordinates for 4 corners of axes 1 and 2:
axes1x2 = axes1x1 + axes1width;
axes1y2 = axes1y1 + axes1height;
positionaxes2 = get(handles.axes2, 'Position');
axes2x1 = positionaxes2(1);
axes2y1 = positionaxes2(2);
axes2width = positionaxes2(3);
axes2height = positionaxes2(4);
axes2x2 = axes2x1 + axes2width;
axes2y2 = axes2y1 + axes2height;
transnucleotide = nucleotides';
undernucleotide = repelem(transnucleotide,[1],[60]);
bacteria1letters = cell(1,60);
bacteria2letters = cell(1,60);
w=1;
c = get (gca, 'CurrentPoint');
x = c(1,1);
y = c(1,2);
[x1,y1,button(a)] = ginput(60);
[x2,y2,button(a)] = ginput(60);
% [x1,y1] = ginput(numberbasestoselectbacteria1);
%
% [x2,y2] = ginput(numberbasestoselectbacteria2);
bacteria1x = ceil (x1-0.5);
bacteria1y = ceil (y1-0.5);
% if button(a) == 1
for m = 1 : length(bacteria1x)
bacteria1letters{1,bacteria1x(m)} = undernucleotide{bacteria1y(m),bacteria1x(m)};
end
bacteria1empty = find(cellfun('isempty',bacteria1letters)); % find empty cells
bacteria1letters(bacteria1empty) = {'NA'};
bacteria1sequence = strjoin(string (bacteria1letters));
%%%%%%%%
bacteria2x = ceil (x2-0.5);
bacteria2y = ceil (y2-0.5);
for n = 1 : length(bacteria2x)
bacteria2letters{1,bacteria2x(n)} = undernucleotide{bacteria2y(n),bacteria2x(n)};
end
bacteria2empty = find(cellfun('isempty',bacteria2letters)); % find empty cells
bacteria2letters(bacteria2empty) = {'NA'};
bacteria2sequence = strjoin(string (bacteria2letters));
% Create a new variable "sequencesandpvalues" that contains
% user selected sequences and p values:
sequencesandpvalues = cell(3,60);
sequencesandpvalues(1,:) = bacteria1letters
sequencesandpvalues(2,:) = bacteria2letters
sequencesandpvalues(3,:) = pstring;
set(handles.uitable3, 'data', sequencesandpvalues)
end
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
list = get(handles.popupmenu1,'String');
idx1 = get(handles.popupmenu1,'Value');
bacteria1name = list{idx1};
set(handles.text6, 'String',bacteria1name)
% --- Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu2
list = get(handles.popupmenu1,'String');
idx2 = get(handles.popupmenu2,'Value');
bacteria2name = list{idx2};
set(handles.text7, 'String',bacteria2name)
% --- Executes during object creation, after setting all properties.
function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function bacteria1_Callback(hObject, eventdata, handles)
% hObject handle to bacteria1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of bacteria1 as text
% str2double(get(hObject,'String')) returns contents of bacteria1 as a double
% --- Executes during object creation, after setting all properties.
function bacteria1_CreateFcn(hObject, eventdata, handles)
% hObject handle to bacteria1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function bacteria2_Callback(hObject, eventdata, handles)
% hObject handle to bacteria2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of bacteria2 as text
% str2double(get(hObject,'String')) returns contents of bacteria2 as a double
% --- Executes during object creation, after setting all properties.
function bacteria2_CreateFcn(hObject, eventdata, handles)
% hObject handle to bacteria2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function bacteria3_Callback(hObject, eventdata, handles)
% hObject handle to bacteria3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of bacteria3 as text
% str2double(get(hObject,'String')) returns contents of bacteria3 as a double
% --- Executes during object creation, after setting all properties.
function bacteria3_CreateFcn(hObject, eventdata, handles)
% hObject handle to bacteria3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function bacteria4_Callback(hObject, eventdata, handles)
% hObject handle to bacteria4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of bacteria4 as text
% str2double(get(hObject,'String')) returns contents of bacteria4 as a double
% --- Executes during object creation, after setting all properties.
function bacteria4_CreateFcn(hObject, eventdata, handles)
% hObject handle to bacteria4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in togglebutton1.
function togglebutton1_Callback(hObject, eventdata, handles)
% hObject handle to togglebutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of togglebutton1.