Difference between revisions of "Team:Dundee/Modeling/Appendix2"
Fmacfarlane (Talk | contribs) |
Fmacfarlane (Talk | contribs) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<html> | <html> | ||
− | + | ||
− | + | ||
− | + | ||
Line 112: | Line 110: | ||
− | <div | + | <div class="container"><!--All content within the division is of the container class, i.e has a margin--> |
<a class="anchor" id="pca"></a><!--Sets anchor so that section can be navigated back to using #pca command--> | <a class="anchor" id="pca"></a><!--Sets anchor so that section can be navigated back to using #pca command--> | ||
Line 133: | Line 131: | ||
xlrange = <span class="string">'B2:JN16'</span>; | xlrange = <span class="string">'B2:JN16'</span>; | ||
A = xlsread(filename,sheet,xlrange); | A = xlsread(filename,sheet,xlrange); | ||
− | <span class="comment">% Raw chromatogram values have been normalized to the sum to take measure the quantitative changes between the different compounds | + | <span class="comment">% Raw chromatogram values have been normalized to the sum to take measure the quantitative changes between the different compounds analysed in the dataset.</span> |
<span class="comment">%</span> | <span class="comment">%</span> | ||
<span class="comment">%</span> | <span class="comment">%</span> | ||
<span class="comment"><b>%% Section 2. Normalisation and Orthogonal transformation of data.</b></span> | <span class="comment"><b>%% Section 2. Normalisation and Orthogonal transformation of data.</b></span> | ||
data = A; [M,N] = size(data); mn = mean(data,2); | data = A; [M,N] = size(data); mn = mean(data,2); | ||
− | dataN = data - repmat(mn,1,N) ; <span class="comment">%data normalising by | + | dataN = data - repmat(mn,1,N) ; <span class="comment">%data normalising by subtracting column mean from each column.</span> |
Z= dataN' / sqrt(N-1); | Z= dataN' / sqrt(N-1); | ||
[u,S,PC] = svd(Z); <span class="comment">%Singular value decomposition</span> | [u,S,PC] = svd(Z); <span class="comment">%Singular value decomposition</span> | ||
signals = PC'*dataN; | signals = PC'*dataN; | ||
− | <span class="comment">% In order to have total control and understanding of the matrix operations behind the PCA, the traditional singular value decomposition linear algebraic operations were used instead of the PCA | + | <span class="comment">% In order to have total control and understanding of the matrix operations behind the PCA, the traditional singular value decomposition linear algebraic operations were used instead of the PCA MATLAB function on the data.</span> |
<span class="comment">%</span> | <span class="comment">%</span> | ||
<span class="comment">%</span> | <span class="comment">%</span> | ||
Line 165: | Line 163: | ||
<span class="comment">%</span> | <span class="comment">%</span> | ||
<span class="comment">%</span> | <span class="comment">%</span> | ||
− | <span class="comment"><b>%% Section 4. Scoreplot of composite | + | <span class="comment"><b>%% Section 4. Scoreplot of composite degradation against time with respect to first two PCs.</b></span> |
figure | figure | ||
colour2=[ [1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];<span class="keyword">...</span> | colour2=[ [1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];<span class="keyword">...</span> | ||
Line 225: | Line 223: | ||
<span class="comment">%</span> | <span class="comment">%</span> | ||
<span class="comment"><b>%% Section 6. Comparing eigenvalues from PCA and SVD.</b></span> | <span class="comment"><b>%% Section 6. Comparing eigenvalues from PCA and SVD.</b></span> | ||
− | [COEFF,SCORE,latent]=pca(data'); <span class="comment">% | + | [COEFF,SCORE,latent]=pca(data'); <span class="comment">% Transpose data before plugging into function</span> |
<span class="comment">% PCA function was applied to the normalised data to compare the eigenvalues from the covariance matrix diag(S) with latent.</span> | <span class="comment">% PCA function was applied to the normalised data to compare the eigenvalues from the covariance matrix diag(S) with latent.</span> | ||
− | latent; <span class="comment">% Returns the eigenvalues of the | + | latent; <span class="comment">% Returns the eigenvalues of the covariance matrix.</span> |
<span class="comment">% latent omits zero value eigenvalues.</span> | <span class="comment">% latent omits zero value eigenvalues.</span> | ||
eigenSVD = diag(S).^2; | eigenSVD = diag(S).^2; | ||
Line 233: | Line 231: | ||
<span class="comment">%</span> | <span class="comment">%</span> | ||
<span class="comment">%</span> | <span class="comment">%</span> | ||
− | + | ||
<span class="comment"><b>%% Section 7. Evaluation of variance coverage by principal components.</b></span> | <span class="comment"><b>%% Section 7. Evaluation of variance coverage by principal components.</b></span> | ||
latentcov=cumsum(latent)./sum(latent); <span class="comment">% 98% of the variance is accounted for by first 3 PCs from PCA package.</span> | latentcov=cumsum(latent)./sum(latent); <span class="comment">% 98% of the variance is accounted for by first 3 PCs from PCA package.</span> | ||
Line 776: | Line 774: | ||
title(<span class="string">'Degradation Principle Composites Against Time For CB003 Donor'</span>); | title(<span class="string">'Degradation Principle Composites Against Time For CB003 Donor'</span>); | ||
xlabel(<span class="string">'Time (days)'</span>); | xlabel(<span class="string">'Time (days)'</span>); | ||
− | ylabel(<span class="string">'Normalised | + | ylabel(<span class="string">'Normalised Chromatogram Values'</span>); |
<span class="comment">% Donor CA006</span> | <span class="comment">% Donor CA006</span> | ||
xlrange6 =<span class="string">'B26:N26'</span>; <span class="comment">%hexa</span> | xlrange6 =<span class="string">'B26:N26'</span>; <span class="comment">%hexa</span> | ||
Line 802: | Line 800: | ||
title(<span class="string">'Degradation Principle Composites Against Time For CA006 Donor'</span>); | title(<span class="string">'Degradation Principle Composites Against Time For CA006 Donor'</span>); | ||
xlabel(<span class="string">'Time (days)'</span>); | xlabel(<span class="string">'Time (days)'</span>); | ||
− | ylabel(<span class="string">'Normalised | + | ylabel(<span class="string">'Normalised Chromatogram Values'</span>); |
<span class="comment">% CB033</span> | <span class="comment">% CB033</span> | ||
xlrange9 =<span class="string">'B31:N31'</span>; <span class="comment">%hexa</span> | xlrange9 =<span class="string">'B31:N31'</span>; <span class="comment">%hexa</span> | ||
Line 828: | Line 826: | ||
title(<span class="string">'Degradation Principle Composites Against Time For CB033 Donor'</span>); | title(<span class="string">'Degradation Principle Composites Against Time For CB033 Donor'</span>); | ||
xlabel(<span class="string">'Time (days)'</span>); | xlabel(<span class="string">'Time (days)'</span>); | ||
− | ylabel(<span class="string">'Normalised | + | ylabel(<span class="string">'Normalised Chromatogram Values'</span>); |
<span class="comment">%DA080</span> | <span class="comment">%DA080</span> | ||
xlrange12 =<span class="string">'B36:N36'</span>; <span class="comment">%hexa</span> | xlrange12 =<span class="string">'B36:N36'</span>; <span class="comment">%hexa</span> | ||
Line 854: | Line 852: | ||
title(<span class="string">'Degradation Principle Composites Against Time For DA080 Donor'</span>); | title(<span class="string">'Degradation Principle Composites Against Time For DA080 Donor'</span>); | ||
xlabel(<span class="string">'Time (days)'</span>); | xlabel(<span class="string">'Time (days)'</span>); | ||
− | ylabel(<span class="string">'Normalised | + | ylabel(<span class="string">'Normalised Chromatogram Values'</span>); |
<span class="comment">%</span> | <span class="comment">%</span> | ||
<span class="comment">%</span> | <span class="comment">%</span> | ||
Line 899: | Line 897: | ||
\end{eqnarray*} | \end{eqnarray*} | ||
$$ | $$ | ||
− | <p>Two files were written to perform sensitivity analysis; one to set the function (squalene.m) and one to solve the function and plot the results in <u><a href="https://2015.igem.org/wiki/index.php?title=Team:Dundee/Modeling/Fingerprints#modelfig1">Figure | + | <p>Two files were written to perform sensitivity analysis; one to set the function (squalene.m) and one to solve the function and plot the results in <u><a href="https://2015.igem.org/wiki/index.php?title=Team:Dundee/Modeling/Fingerprints#modelfig1">Figure 6</a></u> (run_squalene.m). Both files are shown below, where the green text is comments to aid in understanding of the scripts.</p> |
<br><!--Adds a line break--> | <br><!--Adds a line break--> | ||
</div> | </div> |
Latest revision as of 22:10, 18 September 2015
Dry Lab
Appendix 2: Fingerprint Ageing Code
Principal Component Analysis Code
Principal component analysis was performed using MATLAB software to produce the data and figures described in the PCA Section. The MATLAB file can be seen below, where green represents comments to aid in understanding the commands.
MATLAB code from FrickPCA.m file %% Section 1. Importing the data from excel onto MATLAB. filename = 'frick.xlsx'; sheet = 3; % Sheet 3 contains only normalised values with all donors encapsulated into a single matrix. xlrange = 'B2:JN16'; A = xlsread(filename,sheet,xlrange); % Raw chromatogram values have been normalized to the sum to take measure the quantitative changes between the different compounds analysed in the dataset. % % %% Section 2. Normalisation and Orthogonal transformation of data. data = A; [M,N] = size(data); mn = mean(data,2); dataN = data - repmat(mn,1,N) ; %data normalising by subtracting column mean from each column. Z= dataN' / sqrt(N-1); [u,S,PC] = svd(Z); %Singular value decomposition signals = PC'*dataN; % In order to have total control and understanding of the matrix operations behind the PCA, the traditional singular value decomposition linear algebraic operations were used instead of the PCA MATLAB function on the data. % % %% Section 3. Scoreplot of Interdonal variation with respect to first two PCs. pointsize=50; figure % Scoreplot of Interdonal variation colour1= [ [0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0];[0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0];[0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0];[0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0];[0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0];[0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0];[0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0];[0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0];[0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0];[0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0];[0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0];[0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0];[0.5 0.5 0]; [0.5 0.5 0];[0.5 0.5 0];[1 0 1]; [1 0 1];[1 0 1];[0 0.5 0.5]; [0 0.5 0.5];[0 0.5 0.5];[0.5 0 0];[0.5 0 0];[0.5 0 0]; [0 0.5 0];[0 0.5 0];[0 0.5 0]; [0 0 0.4]; [0 0 0.4];[0 0 0.4];[1 0 0];[1 0 0];[1 0 0]]; scatter(signals(1,:),signals(2,:),pointsize,colour1,'filled'); title('Scoreplot Of Interdonal Variation In Fingerprints Against Time W.R.T First Two Principal Components') xlabel('PC1') ylabel('PC2') text(-0.5,-0.201,'\bf \fontsize{10}Donor Key'); %Artisan Legend text(-0.5,-0.234,'\bf \color[rgb]{0.5,0.5,0}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}CB003'); text(-0.5,-0.256,'\bf \color[rgb]{1,0,1}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}CA006'); text(-0.5,-0.278,'\bf \color[rgb]{0,0.5,0.5}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}CB033'); text(-0.5,-0.3,'\bf \color[rgb]{0.5,0,0}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}DA080'); text(-0.5,-0.322,'\bf \color[rgb]{0,0.5,0}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}CA100'); text(-0.5,-0.344,'\bf \color[rgb]{0,0,0.4}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}DA103'); text(-0.5,-0.366,'\bf \color[rgb]{1,0,0}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}CB135'); %This figure shows interdonal variation between all the donors and their aged fingerprint samples from all ageing intervals. Along the first PC, both inter and intra variation appear to increase. Moreover, this graph shows that individual donor samples DO NOT distinctly group together in a dichotomous manner which means that it would not be possible to deduce which fingerprint corresponds to which donor based on their Principal Components (PCs). The donor dots appear to follow faintly separate trajectories along the first PC axis, this suggests a distinct intradonal variation across all donors. This partly confirms the feasibility of a fingerprint age presumptive test. To further understand the nature of fingerprint compound degradation and its relationship between donors the following must be investigated: How much of which compounds contribute to forming the first two principal components? %This would be explored through 'factor loading'(See Section 14 of code), How much do the first two PCs represent the total variance of the dataset?(See Section 7 of code), and if fingerprints from different donors age the at the same rate? (Section 4) % % %% Section 4. Scoreplot of composite degradation against time with respect to first two PCs. figure colour2=[ [1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];[1 1 0];... [0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];[0 0 0.2];... [0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0]; [0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];[0 0.3 0];... [0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3]; [0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];[0 0.3 0.3];... [0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];[0.4 0 0.4];... [0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];[0.2 0 0];... [0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];[0.1 0.1 0];... [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6]; [0 0 0.6];[0 0 0.6];... [0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];[0 0.9 0];... [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6]; [0 0.6 0.6];[0 0.6 0.6];... [0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];[0.8 0 0.8];... [0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];[0.8 0 0];... [0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0];[0.5 0.5 0]]; scatter(signals(1,:),signals(2,:),pointsize,colour2,'filled'); title('Scoreplot of Composite Degradation Against Time W.R.T The First Two Principal Components'); xlabel('PC1'); ylabel('PC2'); text(0.62,0.2,'Time (days)'); text(0.62,0.15,'\bf\color[rgb]{1,1,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 0'); text(0.62,0.125,'\bf\color[rgb]{0,0,0.2}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 2'); text(0.62,0.1,'\bf\color[rgb]{0,0.3,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 5'); text(0.62,0.075,'\bf\color[rgb]{0,0.3,0.3}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 7'); text(0.62,0.05,'\bf\color[rgb]{0.4,0,0.4}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 9'); text(0.62,0.025,'\bf\color[rgb]{0.2,0,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 12'); text(0.62,0,'\bf\color[rgb]{0.1,0.1,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 14'); text(0.62,-0.025,'\bf\color[rgb]{0,0,0.6}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 16'); text(0.62,-0.05,'\bf\color[rgb]{0,0.9,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 19'); text(0.62,-0.075,'\bf\color[rgb]{0,0.6,0.6}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 21'); text(0.62,-0.1,'\bf\color[rgb]{0.8,0,0.8}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 23'); text(0.62,-0.125,'\bf\color[rgb]{0.8,0,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 26'); text(0.62,-0.15,'\bf\color[rgb]{0.5,0.5,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 28'); %This PC graph with respect to time is difficult to interpret due to the plethora of colours. The graph shows that the older a fingerprint is the more difficult it is to pinpoint their age. The lack of distinct groupings between tandem day intervals shows that fingerprints do not age at a constant rate across all donors. This suggests that to construct an age curve would require intra specificity. This rejects the hypothesis of creating a 'one size fits all age curve' for any random fingerprnt of age deduction. An attempt to explore the behaviour of aged fingerprints in greater detail is in section 17. % % %% Section 5. Scatterplot of entire signal data in 3D. figure scatter3(signals(1,:),signals(2,:),signals(3,:),pointsize,colour1,'filled') title('Interdonal Variation Represented By First Three Principal Components') xlabel('PC1') ylabel('PC2') zlabel('PC3') correctedPosition = get(gcf,'Position') + [21 -125 0 0]; fps = 60; sec = 5; vidObj = VideoWriter('newfile.avi'); vidObj.Quality = 100; vidObj.FrameRate = fps; open(vidObj); for i=1:fps*sec camorbit(0.9,-0.1); writeVideo(vidObj,getframe(gcf, correctedPosition)); end close(vidObj); % Video animation of Interdonal variation along first three PCs. % % %% Section 6. Comparing eigenvalues from PCA and SVD. [COEFF,SCORE,latent]=pca(data'); % Transpose data before plugging into function % PCA function was applied to the normalised data to compare the eigenvalues from the covariance matrix diag(S) with latent. latent; % Returns the eigenvalues of the covariance matrix. % latent omits zero value eigenvalues. eigenSVD = diag(S).^2; %Both methods of analysis are expected to provide different principal components but the same eigenvalues. This is a check for consistency. % % %% Section 7. Evaluation of variance coverage by principal components. latentcov=cumsum(latent)./sum(latent); % 98% of the variance is accounted for by first 3 PCs from PCA package. Scoverage=cumsum(diag(S))./sum(diag(S)); % 76% of the var is accounted for by the first 3 PCs from svd package. % % %% Section 8. Curating normalised data for CB003 donor. CB003_dataN = array2table(dataN); filename2 = 'CB003Norm.xlsx'; writetable(CB003_dataN,filename2,'sheet',1); %Used this newly created spreadsheet on Excel to %manually cut out CB003 from the rest of the donors SheetCB3_2 = 2; xlrange1= 'A1:AM15'; CB003 = xlsread(filename2,SheetCB3_2,xlrange1); % % %% Section 9. Curating normalised data to for CB135 donor. SheetCB135_3 = 3; CB135 = xlsread(filename2,SheetCB135_3,xlrange1); % % %% Section 10. CB003 interdonal PCA. signalsCB003 = PC'*CB003; figure scatter(signalsCB003(1,:),signalsCB003(2,:),'filled')%first row all columns,second row all columns. title('CB003 Interdonal Score Plot Analysis') xlabel('PC1') ylabel('PC2') %This figure shows how much the principle components for the whole sample reflects on the particular CB003 donor in other words, the interdonor variation between CB003 and the rest of the samples. % % %% Section 11. CB135 interdonal PCA. signalsCB135 = PC'*CB135; figure scatter(signalsCB135(1,:),signalsCB135(2,:)) title('CB135 interdonal score plot analysis') xlabel('PC1') ylabel('PC2') % Measuring the degradation of composites from donor CB135 against the PCs % of entire sample. % % %% Section 12. PCA Intravariation in CB003. Z1 = CB003'/sqrt(N-1); [u1,S1,PC1]= svd(Z1); % Principal matrix made only by CB003 sample alone intrasignalCB3 = PC1'*CB003; figure scatter(intrasignalCB3(1,:),intrasignalCB3(2,:),'filled') title('Intravariation scoreplot of first two principal components of Donor CB003') xlabel('PC1') ylabel('PC2') % % %% Section 13. PCA Intravariation in CB135. Z2 = CB135'/sqrt(N-1); [u2,S2,PC2] = svd(Z2); intrasignalCB135=PC2'*CB135; figure scatter(intrasignalCB135(1,:),intrasignalCB135(2,:)) title('Intravariation scoreplot of first two principal components of Donor CB135') xlabel('PC1') ylabel('PC2') % % %% Section 14. Factor loadings for PC produced from SVD. % This tells us how much each compound contributes to each of the primary three principal components given that PC1 accounts for 60% of the data according to the SVD reading on chapter 7. signalT = signals'; figure biplot(PC(:,1:2),'scores',signalT(:,1:2),'VarLabels',... {'Tetra','Penta','Hexa','Palmitic','Oliec','Stearic','Squalene','C24','C30:1','C30:0','CHO','C32:1','C32:0','C34:1','C34:0'},'LineWidth',2) % (:,1:2) = all rows of first two columns--opposite to written algrebra title('Biplot Of Finger Composite Contribution To First Two Principal Components [SVD]') xlabel('PC1') ylabel('PC2') figure biplot(PC(:,1:3),'scores',signalT(:,1:3),'VarLabels',... {'Tetra','Penta','Hexa','Palmitic','Oliec','Stearic','Squalene','C24','C30:1','C30:0','CHO','C32:1','C32:0','C34:1','C34:0'}) title('Biplot Of Finger Composite Contribution To First Three Principal Components [SVD]') % % %% Section 15. Factor loadings for PC produced from PCA package. figure biplot(COEFF(:,1:2),'Scores',SCORE(:,1:2),'VarLabels',... {'Tetra','Penta','Hexa','Palmitic','Oliec','Stearic','Squalene','C24','C30:1','C30:0','CHO','C32:1','C32:0','C34:1','C34:0'}) title('Biplot Of Finger Composite Contribution To First Two Principal Components [PCA]') xlabel('PC1') ylabel('PC2') figure biplot(COEFF(:,1:3),'Scores',SCORE(:,1:3),'VarLabels',... {'Tetra','Penta','Hexa','Palmitic','Oliec','Stearic','Squalene','C24','C30:1','C30:0','CHO','C32:1','C32:0','C34:1','C34:0'}) title('Biplot Of Finger Composite Contribution To First Three Principal Components [PCA]') xlabel('PC1') ylabel('PC2') zlabel('PC3') correctedPosition = get(gcf,'Position') + [21 -125 0 0]; fps = 60; sec = 10; vidObj = VideoWriter('newfile.avi'); vidObj.Quality = 100; vidObj.FrameRate = fps; open(vidObj); for i=1:fps*sec camorbit(0.9,-0.1); writeVideo(vidObj,getframe(gcf, correctedPosition)); end close(vidObj); %Results suggest Squalene consitutes 80% of the first PC and 20% of the second. %Palmitic acid constitutes 65% of second PC and -40% of first. % % %% Section 16. PC1 Axis Comparison. %In order to view the relationship between time and squalene more clearly,the samples of each donor were grouped based on age and plotted against PC1 to see how the data aligns. This also aims to see whether or not squalene breaks down at a consistent rate across all donors. % Day 0 Sheet_time_0 = 6; xlranget0= 'B2:V16'; day_0 = xlsread(filename,Sheet_time_0,xlranget0); [M1,N1] = size(day_0); mn1 = mean(day_0,2); day0N = day_0 - repmat(mn,1,N1); signals_t_0 = PC'*day0N; % Day 2 Sheet_time_2 = 6; xlranget2= 'B19:V33'; day_2 = xlsread(filename,Sheet_time_2,xlranget2); mn2 = mean(day_2,2); day2N = day_2 - repmat(mn2,1,N1); signals_t_2 = PC'*day2N; % Day 5 Sheet_time_5 = 6; xlranget5= 'B36:V50'; day_5 = xlsread(filename,Sheet_time_5,xlranget5); mn3 = mean(day_5,2); day5N = day_5 - repmat(mn3,1,N1); signals_t_5 = PC'*day5N; % Day 7 Sheet_time_7 = 6; xlranget7= 'B53:V67'; day_7 = xlsread(filename,Sheet_time_7,xlranget7); mn4 = mean(day_7,2); day7N = day_7 - repmat(mn4,1,N1); signals_t_7 = PC'*day7N; % Day 9 Sheet_time_9 = 6; xlranget9= 'B70:V84'; day_9 = xlsread(filename,Sheet_time_9,xlranget9); mn5 = mean(day_9,2); day9N = day_9 - repmat(mn5,1,N1); signals_t_9 = PC'*day9N; % Day 12 Sheet_time_12 = 6; xlranget12= 'B87:V101'; day_12 = xlsread(filename,Sheet_time_12,xlranget12); mn6 = mean(day_12,2); day12N = day_12 - repmat(mn6,1,N1); signals_t_12 = PC'*day12N; % Day 14 Sheet_time_14 = 6; xlranget14= 'B104:V118'; day_14 = xlsread(filename,Sheet_time_14,xlranget14); mn7 = mean(day_14,2); day14N = day_14 - repmat(mn7,1,N1); signals_t_14 = PC'*day14N; % Day 16 Sheet_time_16 = 6; xlranget16= 'B121:V135'; day_16 = xlsread(filename,Sheet_time_16,xlranget16); mn8 = mean(day_16,2); day16N = day_16 - repmat(mn8,1,N1); signals_t_16 = PC'*day16N; % Day 19 Sheet_time_19 = 6; xlranget19= 'B138:V152'; day_19 = xlsread(filename,Sheet_time_19,xlranget19); mn9 = mean(day_19,2); day19N = day_19 - repmat(mn9,1,N1); signals_t_19 = PC'*day19N; % Day 21 Sheet_time_21 = 6; xlranget21= 'B155:V169'; day_21 = xlsread(filename,Sheet_time_21,xlranget21); mn10 = mean(day_21,2); day21N = day_21 - repmat(mn10,1,N1); signals_t_21 = PC'*day21N; % Day 23 Sheet_time_23 = 6; xlranget23= 'B172:V186'; day_23 = xlsread(filename,Sheet_time_23,xlranget23); mn11 = mean(day_23,2); day23N = day_23 - repmat(mn11,1,N1); signals_t_23 = PC'*day23N; % Day 26 Sheet_time_26 = 6; xlranget26= 'B187:V203'; day_26 = xlsread(filename,Sheet_time_26,xlranget26); mn12 = mean(day_26,2); day26N = day_26 - repmat(mn12,1,N1); signals_t_26 = PC'*day26N; % Day 28 Sheet_time_28 = 6; xlranget28= 'B155:V169'; day_28 = xlsread(filename,Sheet_time_28,xlranget21); mn13 = mean(day_28,2); day28N = day_28 - repmat(mn13,1,N1); signals_t_28 = PC'*day28N; % % %% Section 16.1 Interdonal Alignment Of Fingerprint Sample Age Along First Principal Alignment Axis. spacing = [0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1]; spacing1 = [0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2]; spacing2 = [0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3]; spacing3 = [0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4]; spacing4 = [0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5]; spacing5 = [0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6]; spacing6 = [0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7]; spacing7 = [0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8]; spacing8 = [0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9]; spacing9= [1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0]; spacing10= [1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1]; spacing11= [1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2]; spacing12= [1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3]; col1 = [1 1 0]; col2 = [0 0 0.2]; col3=[0 0.3 0];col4=[0 0.3 0.3]; col5=[0.4 0 0.4];col6=[0.2 0 0];col7=[0.1 0.1 0]; col8=[0 0 0.6];col9=[0 0.9 0];col10=[0 0.6 0.6];col11=[0.8 0 0.8];col12=[0.8 0 0];col13=[0.5 0.5 0]; figure hold on scatter(signals_t_28(1,:),spacing12,50,col13,'filled'); % day 28 scatter(signals_t_26(1,:),spacing11,50,col12,'filled'); % day 26 scatter(signals_t_23(1,:),spacing10,50,col11,'filled'); % day 23 scatter(signals_t_21(1,:),spacing9,50,col10,'filled'); % day 21 scatter(signals_t_19(1,:),spacing8,50,col9,'filled'); % day 19 scatter(signals_t_16(1,:),spacing7,50,col8,'filled'); % day 16 scatter(signals_t_14(1,:),spacing6,50,col7,'filled'); % day 14 scatter(signals_t_12(1,:),spacing5,50,col6,'filled'); % day 12 scatter(signals_t_9(1,:),spacing4,50,col5,'filled'); % day 9 scatter(signals_t_7(1,:),spacing3,50,col4,'filled'); % day 7 scatter(signals_t_5(1,:),spacing2,50,col3,'filled'); % day 5 scatter(signals_t_2(1,:),spacing1,50,col2,'filled'); % day 2 scatter(signals_t_0(1,:),spacing,50,col1,'filled'); % day 0 hold off set(gca,'YTick',[],'XTick',[]); title('Alignment of Aged Fingerprint Data with respect to First Principal Component Axis'); xlabel('PC1'); legend('day 28','day 26','day 23','day 21','day 19','day 16','day 14','day 12','day 9','day 7','day 5','day 2','day 0'); % % %% Section 16.2 Intradonal Alignment against PC1. % CB003 % Day 0 Sheet_CB3_0 = 2; xlrangeCB3_0= 'B2:D16'; cb3_0 = xlsread(filename,Sheet_CB3_0,xlrangeCB3_0); [M2,N2] = size(cb3_0); mncb31 = mean(cb3_0,2); cb3_0N = cb3_0 - repmat(mn,1,N2); signals_cb3_0 = PC'*cb3_0N; % Day 2 Sheet_cb3_2 = 2; xlrangeCB3_2= 'E2:G16'; cb3_2 = xlsread(filename,Sheet_cb3_2,xlrangeCB3_2); mncb3_2 = mean(cb3_2,2); cb3_2N = cb3_2 - repmat(mncb3_2,1,N2); signals_cb3_2 = PC'*cb3_2N; % Day 5 Sheet_cb3_5 = 2; xlrangeCB3_5= 'H2:J16'; cb3_5 = xlsread(filename,Sheet_cb3_5,xlrangeCB3_5); mncb3_3 = mean(cb3_5,2); cb3_5N = cb3_5 - repmat(mncb3_3,1,N2); signals_cb3_5 = PC'*cb3_5N; % Day 7 Sheet_cb3_7 = 2; xlrangeCB_7= 'K2:M16'; cb3_7 = xlsread(filename,Sheet_cb3_7,xlrangeCB_7); mncb4 = mean(cb3_7,2); cb3_7N = cb3_7 - repmat(mncb4,1,N2); signals_cb3_7 = PC'*cb3_7N; % Day 9 Sheet_cb3_9 = 2; xlrangeCB_9= 'N2:P16'; cb3_9 = xlsread(filename,Sheet_cb3_9,xlrangeCB_9); mncb5 = mean(cb3_9,2); cb3_9N = cb3_9 - repmat(mncb5,1,N2); signals_cb3_9 = PC'*cb3_9N; % Day 12 Sheet_cb3_12 = 2; xlrangeCB12= 'Q2:S16'; cb3_12 = xlsread(filename,Sheet_cb3_12,xlrangeCB12); mncb6 = mean(cb3_12,2); cb3_12N = cb3_12 - repmat(mncb6,1,N2); signals_cb3_12 = PC'*cb3_12N; % Day 14 Sheet_CB3_14 = 2; xlrangeCB14= 'T2:V16'; cb3_14 = xlsread(filename,Sheet_CB3_14,xlrangeCB14); mncb7 = mean(cb3_14,2); cb3_14N = cb3_14 - repmat(mncb7,1,N2); signals_cb3_14 = PC'*cb3_14N; % Day 16 Sheet_CB3_16 = 2; xlrangeCB16= 'W2:Y16'; cb3_16 = xlsread(filename,Sheet_CB3_16,xlrangeCB16); mncb8 = mean(cb3_16,2); cb3_16N = cb3_16 - repmat(mncb8,1,N2); signals_cb3_16 = PC'*cb3_16N; % Day 19 Sheet_CB3_19 = 2; xlrangeCB19= 'Z2:AB16'; cb3_19 = xlsread(filename,Sheet_CB3_19,xlrangeCB19); mncb9 = mean(cb3_19,2); cb3_19N = cb3_19 - repmat(mncb9,1,N2); signals_cb3_19 = PC'*cb3_19N; % Day 21 Sheet_CB3_21 = 2; xlrangeCB21= 'AC2:AE16'; cb3_21 = xlsread(filename,Sheet_CB3_21,xlrangeCB21); mncb10 = mean(cb3_21,2); cb3_21N = cb3_21 - repmat(mncb10,1,N2); signals_cb3_21 = PC'*cb3_21N; % Day 23 Sheet_CB3_23 = 2; xlrangeCB23= 'AF2:AH16'; cb3_23 = xlsread(filename,Sheet_CB3_23,xlrangeCB23); mncb11 = mean(cb3_23,2); cb3_23N = cb3_23 - repmat(mncb11,1,N2); signals_cb3_23 = PC'*cb3_23N; % Day 26 Sheet_CB3_26 = 2; xlrangeCB26= 'AI2:AK16'; cb3_26 = xlsread(filename,Sheet_CB3_26,xlrangeCB26); mncb13 = mean(cb3_26,2); cb3_26N = cb3_26 - repmat(mncb13,1,N2); signals_cb3_26 = PC'*cb3_26N; % Day 28 Sheet_CB3_28 = 2; xlrangeCB28= 'AL2:AN16'; cb3_28 = xlsread(filename,Sheet_CB3_28,xlrangeCB28); mncb14 = mean(cb3_28,2); cb3_28N = cb3_28 - repmat(mncb14,1,N2); signals_cb3_28 = PC'*cb3_28N; % % %% Section 16.3. %Intraspecific CB003 PC1 Alignment spacing = [0.1 0.1 0.1 ]; spacing1 = [0.2 0.2 0.2 ]; spacing2 = [0.3 0.3 0.3 ]; spacing3 = [0.4 0.4 0.4 ]; spacing4 = [0.5 0.5 0.5 ]; spacing5 = [0.6 0.6 0.6 ]; spacing6 = [0.7 0.7 0.7 ]; spacing7 = [0.8 0.8 0.8 ]; spacing8 = [0.9 0.9 0.9 ]; spacing9= [1.0 1.0 1.0 ]; spacing10= [1.1 1.1 1.1 ]; spacing11= [1.2 1.2 1.2 ]; spacing12= [1.3 1.3 1.3 ]; col1 = [1 1 0]; col2 = [0 0 0.2]; col3=[0 0.3 0];col4=[0 0.3 0.3]; col5=[0.4 0 0.4];col6=[0.2 0 0];col7=[0.1 0.1 0]; col8=[0 0 0.6];col9=[0 0.9 0];col10=[0 0.6 0.6];col11=[0.8 0 0.8];col12=[0.8 0 0];col13=[0.5 0.5 0]; figure hold on scatter(signals_cb3_28(1,:),spacing12,50,col13,'filled'); % day 28 scatter(signals_cb3_26(1,:),spacing11,50,col12,'filled'); % day 26 scatter(signals_cb3_23(1,:),spacing10,50,col11,'filled'); % day 23 scatter(signals_cb3_21(1,:),spacing9,50,col10,'filled'); % day 21 scatter(signals_cb3_19(1,:),spacing8,50,col9,'filled'); % day 19 scatter(signals_cb3_16(1,:),spacing7,50,col8,'filled'); % day 16 scatter(signals_cb3_14(1,:),spacing6,50,col7,'filled'); % day 14 scatter(signals_cb3_12(1,:),spacing5,50,col6,'filled'); % day 12 scatter(signals_cb3_9(1,:),spacing4,50,col5,'filled'); % day 9 scatter(signals_cb3_7(1,:),spacing3,50,col4,'filled'); % day 7 scatter(signals_cb3_5(1,:),spacing2,50,col3,'filled'); % day 5 scatter(signals_cb3_2(1,:),spacing1,50,col2,'filled'); % day 2 scatter(signals_cb3_0(1,:),spacing,50,col1,'filled'); % day 0 hold off % % %% Section 16.31 Donor CB135 PC1 Alignment. % CB135 % Day 0 Sheet_CB135_0 = 7; xlrangeCB3_0= 'B2:D16'; cb3_0 = xlsread(filename,Sheet_CB3_0,xlrangeCB3_0); [M2,N2] = size(cb3_0); mncb31 = mean(cb3_0,2); cb3_0N = cb3_0 - repmat(mn,1,N2); signals_cb3_0 = PC'*cb3_0N; % Day 2 Sheet_cb3_2 = 2; xlrangeCB3_2= 'E2:G16'; cb3_2 = xlsread(filename,Sheet_cb3_2,xlrangeCB3_2); mncb3_2 = mean(cb3_2,2); cb3_2N = cb3_2 - repmat(mncb3_2,1,N2); signals_cb3_2 = PC'*cb3_2N; % Day 5 Sheet_cb3_5 = 7; xlrangeCB3_5= 'H2:J16'; cb3_5 = xlsread(filename,Sheet_cb3_5,xlrangeCB3_5); mncb3_3 = mean(cb3_5,2); cb3_5N = cb3_5 - repmat(mncb3_3,1,N2); signals_cb3_5 = PC'*cb3_5N; % Day 7 Sheet_cb3_7 = 7; xlrangeCB_7= 'K2:M16'; cb3_7 = xlsread(filename,Sheet_cb3_7,xlrangeCB_7); mncb4 = mean(cb3_7,2); cb3_7N = cb3_7 - repmat(mncb4,1,N2); signals_cb3_7 = PC'*cb3_7N; % Day 9 Sheet_cb3_9 = 7; xlrangeCB_9= 'N2:P16'; cb3_9 = xlsread(filename,Sheet_cb3_9,xlrangeCB_9); mncb5 = mean(cb3_9,2); cb3_9N = cb3_9 - repmat(mncb5,1,N2); signals_cb3_9 = PC'*cb3_9N; % Day 12 Sheet_cb3_12 = 7; xlrangeCB12= 'Q2:S16'; cb3_12 = xlsread(filename,Sheet_cb3_12,xlrangeCB12); mncb6 = mean(cb3_12,2); cb3_12N = cb3_12 - repmat(mncb6,1,N2); signals_cb3_12 = PC'*cb3_12N; % Day 14 Sheet_CB3_14 = 7; xlrangeCB14= 'T2:V16'; cb3_14 = xlsread(filename,Sheet_CB3_14,xlrangeCB14); mncb7 = mean(cb3_14,2); cb3_14N = cb3_14 - repmat(mncb7,1,N2); signals_cb3_14 = PC'*cb3_14N; % Day 16 Sheet_CB3_16 = 7; xlrangeCB16= 'W2:Y16'; cb3_16 = xlsread(filename,Sheet_CB3_16,xlrangeCB16); mncb8 = mean(cb3_16,2); cb3_16N = cb3_16 - repmat(mncb8,1,N2); signals_cb3_16 = PC'*cb3_16N; % Day 19 Sheet_CB3_19 = 7; xlrangeCB19= 'Z2:AB16'; cb3_19 = xlsread(filename,Sheet_CB3_19,xlrangeCB19); mncb9 = mean(cb3_19,2); cb3_19N = cb3_19 - repmat(mncb9,1,N2); signals_cb3_19 = PC'*cb3_19N; % Day 21 Sheet_CB3_21 = 7; xlrangeCB21= 'AC2:AE16'; cb3_21 = xlsread(filename,Sheet_CB3_21,xlrangeCB21); mncb10 = mean(cb3_21,2); cb3_21N = cb3_21 - repmat(mncb10,1,N2); signals_cb3_21 = PC'*cb3_21N; % Day 23 Sheet_CB3_23 = 7; xlrangeCB23= 'AF2:AH16'; cb3_23 = xlsread(filename,Sheet_CB3_23,xlrangeCB23); mncb11 = mean(cb3_23,2); cb3_23N = cb3_23 - repmat(mncb11,1,N2); signals_cb3_23 = PC'*cb3_23N; % Day 26 Sheet_CB3_26 = 7; xlrangeCB26= 'AI2:AK16'; cb3_26 = xlsread(filename,Sheet_CB3_26,xlrangeCB26); mncb13 = mean(cb3_26,2); cb3_26N = cb3_26 - repmat(mncb13,1,N2); signals_cb3_26 = PC'*cb3_26N; % Day 28 Sheet_CB3_28 = 7; xlrangeCB28= 'AL2:AN16'; cb3_28 = xlsread(filename,Sheet_CB3_28,xlrangeCB28); mncb14 = mean(cb3_28,2); cb3_28N = cb3_28 - repmat(mncb14,1,N2); signals_cb3_28 = PC'*cb3_28N; spacing = [0.1 0.1 0.1 ]; spacing1 = [0.2 0.2 0.2 ]; spacing2 = [0.3 0.3 0.3 ]; spacing3 = [0.4 0.4 0.4 ]; spacing4 = [0.5 0.5 0.5 ]; spacing5 = [0.6 0.6 0.6 ]; spacing6 = [0.7 0.7 0.7 ]; spacing7 = [0.8 0.8 0.8 ]; spacing8 = [0.9 0.9 0.9 ]; spacing9= [1.0 1.0 1.0 ]; spacing10= [1.1 1.1 1.1 ]; spacing11= [1.2 1.2 1.2 ]; spacing12= [1.3 1.3 1.3 ]; col1 = [1 1 0]; col2 = [0 0 0.2]; col3=[0 0.3 0];col4=[0 0.3 0.3]; col5=[0.4 0 0.4];col6=[0.2 0 0];col7=[0.1 0.1 0]; col8=[0 0 0.6];col9=[0 0.9 0];col10=[0 0.6 0.6];col11=[0.8 0 0.8];col12=[0.8 0 0];col13=[0.5 0.5 0]; figure hold on scatter(signals_cb3_28(1,:),spacing12,50,col13,'filled'); % day 28 scatter(signals_cb3_26(1,:),spacing11,50,col12,'filled'); % day 26 scatter(signals_cb3_23(1,:),spacing10,50,col11,'filled'); % day 23 scatter(signals_cb3_21(1,:),spacing9,50,col10,'filled'); % day 21 scatter(signals_cb3_19(1,:),spacing8,50,col9,'filled'); % day 19 scatter(signals_cb3_16(1,:),spacing7,50,col8,'filled'); % day 16 scatter(signals_cb3_14(1,:),spacing6,50,col7,'filled'); % day 14 scatter(signals_cb3_12(1,:),spacing5,50,col6,'filled'); % day 12 scatter(signals_cb3_9(1,:),spacing4,50,col5,'filled'); % day 9 scatter(signals_cb3_7(1,:),spacing3,50,col4,'filled'); % day 7 scatter(signals_cb3_5(1,:),spacing2,50,col3,'filled'); % day 5 scatter(signals_cb3_2(1,:),spacing1,50,col2,'filled'); % day 2 scatter(signals_cb3_0(1,:),spacing,50,col1,'filled'); % day 0 hold off % % %% Section 17. Age Curves Of Major Composites Found In Principal Components For Each Donor. % Donor CB003 t = [ 0 2 5 7 9 12 14 16 19 21 23 26 28]; xlrange3 ='B21:N21'; %sq xlrange4 ='B22:N22'; %palm xlrange5 ='B23:N23'; %hexa agecurvCB3SQ= xlsread(filename,sheet,xlrange3); agecurvCB3PM= xlsread(filename,sheet,xlrange4); agecurvCB3HX= xlsread(filename,sheet,xlrange5); figure a=agecurvCB3SQ; b=agecurvCB3PM; c=agecurvCB3HX; e =std(a)*ones(size(t)); e1=std(b)*ones(size(t)); e2=std(c)*ones(size(t)); hold on a1 = plot(t,a,'r'); a2 = plot(t,b,'b'); a3 = plot(t,c,'g'); errorbar(t,a,e,'r'); errorbar(t,b,e1,'b'); errorbar(t,c,e2,'g'); hold off legend([a1 a2 a3],'Squalene','Palmitic acid','Hexadecenoic acid'); title('Degradation Principle Composites Against Time For CB003 Donor'); xlabel('Time (days)'); ylabel('Normalised Chromatogram Values'); % Donor CA006 xlrange6 ='B26:N26'; %hexa xlrange7 ='B27:N27'; %palm xlrange8 ='B28:N28'; %sq agecurvCA6HX= xlsread(filename,sheet,xlrange6); agecurvCA6PM= xlsread(filename,sheet,xlrange7); agecurvCA6SQ= xlsread(filename,sheet,xlrange8); figure aa=agecurvCA6SQ; bb=agecurvCA6PM; cc=agecurvCA6HX; ee =std(aa)*ones(size(t)); ee1=std(bb)*ones(size(t)); ee2=std(cc)*ones(size(t)); hold on aa1 = plot(t,aa,'r'); aa2 = plot(t,bb,'b'); aa3 = plot(t,cc,'g'); errorbar(t,aa,ee,'r'); errorbar(t,bb,ee1,'b'); errorbar(t,cc,ee2,'g'); hold off legend([aa1 aa2 aa3],'Squalene','Palmitic acid','Hexadecenoic acid'); title('Degradation Principle Composites Against Time For CA006 Donor'); xlabel('Time (days)'); ylabel('Normalised Chromatogram Values'); % CB033 xlrange9 ='B31:N31'; %hexa xlrange10 ='B32:N32'; %palm xlrange11 ='B33:N33'; %sq agecurvCB33HX= xlsread(filename,sheet,xlrange9); agecurvCB33PM= xlsread(filename,sheet,xlrange10); agecurvCB33SQ= xlsread(filename,sheet,xlrange11); figure aaa=agecurvCB33SQ; bbb=agecurvCB33PM; ccc=agecurvCB33HX; eee =std(aaa)*ones(size(t)); eee1=std(bbb)*ones(size(t)); eee2=std(ccc)*ones(size(t)); hold on aaa1 = plot(t,aaa,'r'); aaa2 = plot(t,bbb,'b'); aaa3 = plot(t,ccc,'g'); errorbar(t,aaa,eee,'r'); errorbar(t,bbb,eee1,'b'); errorbar(t,ccc,eee2,'g'); hold off legend([aaa1 aaa2 aaa3],'Squalene','Palmitic acid','Hexadecenoic acid'); title('Degradation Principle Composites Against Time For CB033 Donor'); xlabel('Time (days)'); ylabel('Normalised Chromatogram Values'); %DA080 xlrange12 ='B36:N36'; %hexa xlrange13 ='B37:N37'; %palm xlrange14 ='B38:N38'; %sq agecurvDA80HX= xlsread(filename,sheet,xlrange12); agecurvDA80PM= xlsread(filename,sheet,xlrange13); agecurvDA80SQ= xlsread(filename,sheet,xlrange14); figure aaaa=agecurvDA80SQ; bbbb=agecurvDA80PM; cccc=agecurvDA80HX; eeee =std(aaaa)*ones(size(t)); eeee1=std(bbbb)*ones(size(t)); eeee2=std(cccc)*ones(size(t)); hold on aaaa1 = plot(t,aaaa,'r'); aaaa2 = plot(t,bbbb,'b'); aaaa3 = plot(t,cccc,'g'); errorbar(t,aaaa,eeee,'r'); errorbar(t,bbbb,eeee1,'b'); errorbar(t,cccc,eeee2,'g'); hold off legend([aaaa1 aaaa2 aaaa3],'Squalene','Palmitic acid','Hexadecenoic acid'); title('Degradation Principle Composites Against Time For DA080 Donor'); xlabel('Time (days)'); ylabel('Normalised Chromatogram Values'); % % % END OF FILE
Squalene Epoxide Model MATLAB Code
The figures shown in the squalene epoxide and lanosterol synthase model were created using MATLAB. Before using MATLAB the original system of equations was non-dimensionalised to the system:
$$ \begin{eqnarray*} \frac{dLS}{d\tau}&=&PC-\lambda LS \cdot SE,\\ \frac{dSE}{d\tau}&=&PC-\lambda LS \cdot SE,\\ \frac{PC}{d\tau}&=&\lambda LS \cdot SE-PC-\gamma PC,\\ \frac{dLa}{d\tau}&=&\gamma PC. \end{eqnarray*} $$The initial conditions were also non-dimensionalised to become:
$$ \begin{eqnarray*} LS(0)&=&v_{0},\\ SE(0)&=&1,\\ PC(0)&=&0,\\ La(0)&=&0. \end{eqnarray*} $$Two files were written to perform sensitivity analysis; one to set the function (squalene.m) and one to solve the function and plot the results in Figure 6 (run_squalene.m). Both files are shown below, where the green text is comments to aid in understanding of the scripts.
MATLAB code from squalene.m file % File to solve the system of ODEs describing lanosterol synthase and squalene epoxide binding. % The vector u has 4 dimensions; % u(1) = Lanosterol synthase (LS) concentration, {non-dimensionalised} % u(2) = Squalene epoxide (SE) concentration, {"} % u(3) = Protosterol cation (PC) concentration (1st Intermediate), {"} % u(4) = Lanosterol (La) concentration. {"} % t is the time that the simulation is run over. % lambda is the 1st binding parameter ((k1/k2)SE(0)). % gamma is the 2nd binding parameter (k3/k2). function f = squalene(t,u,lambda,gamma); % Then set f as the RHS of the system of ODEs. f = [u(3)-lambda.*u(1)*u(2); u(3)-lambda.*u(1)*u(2); lambda.*u(1)*u(2)-u(3)-gamma.*u(3); gamma.*u(3)]; end % Then end the function. % This function can then be solved using ode23 in the file run_squalene.m by using the @squalene command. % END OF FILE. MATLAB code for run_squalene.m file. % File to solve the non-dimensionalised system of ODEs representing the binding of squalene epoxide (SE) and lanosterol synthase (LS) to form lanosterol (La). % % Set the final time of the simulation, set at 30 seconds. T = 30; % Set initial concentration of ratio (LS/SE) as the expected value. u0 = 2.561; % Parameter a is how many values of each parameter are used in the sensitivity analysis. a = 100; % Set lambda1 as the range of values for parameter lambda, where the maximum value is twice the expected. lambda1 = linspace(0,(0.64061499*2),a); % Set gamma1 as the range of values for parameter gamma, where the maximum value is twice the expected. gamma1 = linspace(0,(1.000223733*2),a); % Set Store as an empty matrix to store the values of lanosterol concentrations for each range of values of lambda1 and gamma1. Store = zeros(a,a); % Set a for loop that will solve the system of ODEs from the squalene.m file using the ode23 solver, for each value of lambda1, gamma1. % The resulting values for the lanosterol concentration are stored in the Store matrix. for i=1:a for j=1:a [t,u]=ode23(@squalene,[0 T],[u0 1 0 0],[],lambda1(a+1-i),gamma1(j)); Store(i,j) = u(end,4); end end % Call up a blank figure, so that no other figures are overwritten. figure(1) % Plot a colourplot of Store, that is plot the lanosterol concentration against lambda1 and gamma1. imagesc(Store) % Set the colormap as default colour choice, as this is easiest to see. colormap default % Remove the values on the x and y axis by using the set command. set(gca,'YTick',[],'XTick',[]); % Add a colorbar with user defined axis labels (Tick labels) and label, % 'Complex Concentration'. c=colorbar('Ticks',[0,0.99],'TickLabels',{'None','High'},'FontSize',15,'FontWeight','bold'); c.Label.String = 'Complex Concentration'; % Add labels to the x and y axis for clarity on the plot. xlabel('\fontsize{12} \bf Increasing \lambda'); ylabel('\fontsize{12} \bf Increasing \gamma'); % % %% Section 2: This section is used to plot only lambda against lanosterol concentration over time. % Define store1 as an empty matrix to hold values of LS, SE, PC (1st Intermediate) and La, for each value of lambda1. store1 = zeros(5000,5,a); % 1st is time, 2:5 are u. % Set a for loop that will solve the system of ODEs from the squalene.m file using the ode23 solver, for each value of lambda1, with the expected value of gamma1 used. % The resulting values for LS, SE, PC and the lanosterol concentration are stored in the store1 matrix. for i=1:a [t,u]=ode23(@squalene,[0 T],[2.561 1 0 0],[],lambda1(i),1.000223733); store1(end-size(t,1)+1:end,1,i) = t; store1(end-size(t,1)+1:end,2:5,i) = u; end % Call up a blank figure, so that no other figures are overwritten. figure(2) % Plot the values of lambda1 against the corresponding values of lanosterol concentration over time. plot(lambda1,squeeze(store1(end,5,:)),'LineWidth',2); % Add labels to the x and y axis for clarity on the plot. xlabel('\bf \fontsize{12}Increasing \lambda'); ylabel('\bf \fontsize{12} Lanosterol Concentration'); % Set the axis to tight so that the axis is not too large for the data. axis tight % % %% Section 3: This section is used to plot only gamma against lanosterol concentration over time. % Define store2 as an empty matrix to hold values of LS, SE, PC and La, for each value of gamma1. store2 = zeros(a,5,a); % 1st is time, 2:4 are u. % Set a for loop that will solve the system of ODEs from the squalene.m file using the ode23 solver, for each value of gamma1, with the expected value of lambda1 used. % The resulting values for LS, SE, PC and the lanosterol concentration are stored in the store2 matrix. for i=1:a [t,u]=ode23(@squalene,[0 T],[2.561 1 0 0],[],0.64061499,gamma1(i)); store2(end-size(t,1)+1:end,1,i) = t; store2(end-size(t,1)+1:end,2:5,i) = u; end % Call up a blank figure, so that no other figures are overwritten. figure(3) % Plot the values of gamma1 against the corresponding values of lanosterol concentration over time. plot(gamma1,squeeze(store2(end,5,:)),'LineWidth',2); % Add labels to the x and y axis for clarity on the plot. xlabel('\bf Increasing \gamma'); ylabel('\bf Lanosterol Concentration'); % Set the axis to tight so that the axis is not too large for the data. axis tight % % %% Section 4: This section is used to plot only v0, the ratio of (LS(0)/SE(0)) against lanosterol concentration over time. % Define store3 as an empty matrix to hold values of LS,SE,PC and La, for each value of v0. store3= zeros(a,5,a); % Set v0 as the range of values for v0 with the maximum as twice the expected value. v0=linspace(0,(2.561*2),a); % Set a for loop that will solve the system of ODEs from the squalene.m file using the ode23 solver, for each value of v0, with the expected value of lambda and gamma used. % The resulting values for LS, SE, PC and the lanosterol concentration are stored in the store3 matrix. for i=1:a [t,u]= ode23(@squalene,[0 T],[v0(i) 1 0 0],[],0.64061499,1.00223733); store3(end-size(t,1)+1:end,1,i) = t; store3(end-size(t,1)+1:end,2:5,i) = u; end % Call up a new figure, so that no figures are overwritten. figure(4) % Plot the values of v0 against the corresponding values of lanosterol concentration over time. plot(v0,squeeze(store3(end,5,:)),'LineWidth',2); % Set the axis to tight so that the axis is not too large for the data. axis tight; % Add labels to the x and y axis for clarity on the plot. xlabel('\bf \fontsize{12} Increasing v_{0}'); ylabel('\bf \fontsize{12} Concentration of Lanosterol formed'); % % END OF FILE.
To see the MATLAB code for the FluID section of the project or the Chromate Biosensor section of the project use the following buttons.
Appendix 3: Chromate Biosensor Appendix 1: FluID