Difference between revisions of "Team:Dundee/Modeling/Appendix2"
Fmacfarlane (Talk | contribs) |
Fmacfarlane (Talk | contribs) |
||
Line 130: | Line 130: | ||
Cu vis partem graeci facilisis. Falli inciderint mei no. Assentior suscipiantur mea id. Vis quas electram prodesset cu, choro omnium conclusionemque an his. Vis latine equidem perfecto ad.</p> | Cu vis partem graeci facilisis. Falli inciderint mei no. Assentior suscipiantur mea id. Vis quas electram prodesset cu, choro omnium conclusionemque an his. Vis latine equidem perfecto ad.</p> | ||
<br><!--Adds a line break--> | <br><!--Adds a line break--> | ||
+ | <div class="content"><pre class="codeinput"><!--Inserts code copied from MATLAB published html--> | ||
+ | <span class="comment">% Section 1. Importing the data from excel onto matlab</span> | ||
+ | filename = <span class="string">'frick.xlsx'</span>; | ||
+ | sheet = 3; <span class="comment">% Sheet 3 contains only normalised values with all donors encapsulated into a single matrix.</span> | ||
+ | xlrange = <span class="string">'B2:JN16'</span>; | ||
+ | A = xlsread(filename,sheet,xlrange); | ||
+ | <span class="comment">% Raw chromatogram values have been normalized to the sum to take measure</span> | ||
+ | <span class="comment">% the quantitative changes between the different compounds analyzed in the</span> | ||
+ | <span class="comment">% dataset.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 2. Normalisation and Orthogonal transformation of data</span> | ||
+ | data = A; [M,N] = size(data); mn = mean(data,2); | ||
+ | dataN = data - repmat(mn,1,N) ; <span class="comment">%data normalising by substracting column mean from each column.</span> | ||
+ | Z= dataN' / sqrt(N-1); | ||
+ | [u,S,PC] = svd(Z); <span class="comment">%Singular value decomposition</span> | ||
+ | signals = PC'*dataN; | ||
+ | <span class="comment">% In order to have total control and understanding of the matrix operations</span> | ||
+ | <span class="comment">% behind the PCA, the traditional singular value decomposition linear algebraic</span> | ||
+ | <span class="comment">% operations were used instead of the PCA matlab function on the data.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 3. Scoreplot of Interdonal variation with respect to first two PCs</span> | ||
+ | pointsize=50; | ||
+ | figure <span class="comment">% Scoreplot of Interdonal variation</span> | ||
+ | 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,<span class="string">'filled'</span>); | ||
+ | title(<span class="string">'Scoreplot Of Interdonal Variation In Fingerprints Against Time W.R.T First Two Principal Components'</span>) | ||
+ | xlabel(<span class="string">'PC1'</span>) | ||
+ | ylabel(<span class="string">'PC2'</span>) | ||
+ | text(-0.5,-0.201,<span class="string">'\bf \fontsize{10}Donor Key'</span>); <span class="comment">%Artisan Legend</span> | ||
+ | text(-0.5,-0.234,<span class="string">'\bf \color[rgb]{0.5,0.5,0}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}CB003'</span>); | ||
+ | text(-0.5,-0.256,<span class="string">'\bf \color[rgb]{1,0,1}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}CA006'</span>); | ||
+ | text(-0.5,-0.278,<span class="string">'\bf \color[rgb]{0,0.5,0.5}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}CB033'</span>); | ||
+ | text(-0.5,-0.3,<span class="string">'\bf \color[rgb]{0.5,0,0}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}DA080'</span>); | ||
+ | text(-0.5,-0.322,<span class="string">'\bf \color[rgb]{0,0.5,0}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}CA100'</span>); | ||
+ | text(-0.5,-0.344,<span class="string">'\bf \color[rgb]{0,0,0.4}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}DA103'</span>); | ||
+ | text(-0.5,-0.366,<span class="string">'\bf \color[rgb]{1,0,0}{\fontsize{14}{\bullet}} \color[rgb]{0,0,0} \fontsize{10}CB135'</span>); | ||
+ | <span class="comment">%This figure shows interdonal variation between all the donors and a</span> | ||
+ | <span class="comment">%their aged fingerprint samples from all ageing intervals.Along the first</span> | ||
+ | <span class="comment">%PC, both inter and intra variation appear to increase. Moreover,</span> | ||
+ | <span class="comment">%this graph shows that individual donor samples DO NOT distinctly group</span> | ||
+ | <span class="comment">%together in a dichotomous manner which means that it would not be possible</span> | ||
+ | <span class="comment">%to deduce which fingerprint corresponds to which donor based on their</span> | ||
+ | <span class="comment">%Principal Components (PCs). The donor dots appear to follow faintly</span> | ||
+ | <span class="comment">%separate trajectories along the first PC axis, this suggests a distinct</span> | ||
+ | <span class="comment">%intradonal variation across all donors. This partly confirms the</span> | ||
+ | <span class="comment">%feesiblity of a fingerprint age presumptive test. To further understand</span> | ||
+ | <span class="comment">%the nature of fingerprint compound degradation and its relationship</span> | ||
+ | <span class="comment">%between donors the following must be investigated: How much of which</span> | ||
+ | <span class="comment">%compounds contribute to forming the first two principal components?</span> | ||
+ | <span class="comment">%This would be explored through 'factor loading'(See Chapter 14 of code),</span> | ||
+ | <span class="comment">%How much do the first two PCs represent the total variance of the dataset?</span> | ||
+ | <span class="comment">%(See chapter 7 of code), and if fingerprints from different donors age the</span> | ||
+ | <span class="comment">%at the same rate? (Chapter 4)</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 4. Scoreplot of composite degraduation against time with respect to first two PCs</span> | ||
+ | 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> | ||
+ | [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];<span class="keyword">...</span> | ||
+ | [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];<span class="keyword">...</span> | ||
+ | [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];<span class="keyword">...</span> | ||
+ | [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];<span class="keyword">...</span> | ||
+ | [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];<span class="keyword">...</span> | ||
+ | [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];<span class="keyword">...</span> | ||
+ | [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];<span class="keyword">...</span> | ||
+ | [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];<span class="keyword">...</span> | ||
+ | [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];<span class="keyword">...</span> | ||
+ | [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];<span class="keyword">...</span> | ||
+ | [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];<span class="keyword">...</span> | ||
+ | [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,<span class="string">'filled'</span>); | ||
+ | title(<span class="string">'Scoreplot of Composite Degradation Against Time W.R.T The First Two Principal Components'</span>); | ||
+ | xlabel(<span class="string">'PC1'</span>); | ||
+ | ylabel(<span class="string">'PC2'</span>); | ||
+ | text(0.62,0.2,<span class="string">'Time (days)'</span>); | ||
+ | text(0.62,0.15,<span class="string">'\bf\color[rgb]{1,1,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 0'</span>); | ||
+ | text(0.62,0.125,<span class="string">'\bf\color[rgb]{0,0,0.2}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 2'</span>); | ||
+ | text(0.62,0.1,<span class="string">'\bf\color[rgb]{0,0.3,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 5'</span>); | ||
+ | text(0.62,0.075,<span class="string">'\bf\color[rgb]{0,0.3,0.3}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 7'</span>); | ||
+ | text(0.62,0.05,<span class="string">'\bf\color[rgb]{0.4,0,0.4}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 9'</span>); | ||
+ | text(0.62,0.025,<span class="string">'\bf\color[rgb]{0.2,0,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 12'</span>); | ||
+ | text(0.62,0,<span class="string">'\bf\color[rgb]{0.1,0.1,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 14'</span>); | ||
+ | text(0.62,-0.025,<span class="string">'\bf\color[rgb]{0,0,0.6}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 16'</span>); | ||
+ | text(0.62,-0.05,<span class="string">'\bf\color[rgb]{0,0.9,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 19'</span>); | ||
+ | text(0.62,-0.075,<span class="string">'\bf\color[rgb]{0,0.6,0.6}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 21'</span>); | ||
+ | text(0.62,-0.1,<span class="string">'\bf\color[rgb]{0.8,0,0.8}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 23'</span>); | ||
+ | text(0.62,-0.125,<span class="string">'\bf\color[rgb]{0.8,0,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 26'</span>); | ||
+ | text(0.62,-0.15,<span class="string">'\bf\color[rgb]{0.5,0.5,0}{\fontsize{14}{\bullet}} \color{black}\fontsize{10}Day 28'</span>); | ||
+ | <span class="comment">%This PC graph with respect to time is difficult to interpret due to the</span> | ||
+ | <span class="comment">%plethora of colours. The graph shows that the older a fingerprint is the</span> | ||
+ | <span class="comment">%more diffulcult it is to pinpoint their age.The lack of distinct groupings</span> | ||
+ | <span class="comment">%between tandem day intervals shows that fingerprints do not age at a</span> | ||
+ | <span class="comment">%constant rate across all donors. This suggests that to construct an age</span> | ||
+ | <span class="comment">%curve would require intraspecificity. This rejects the hypothesis of</span> | ||
+ | <span class="comment">%creating a 'one size fits all age curve' for any random fingerprnt of age</span> | ||
+ | <span class="comment">%deduction. An attempt to explore the behaviour of aged fingerprints</span> | ||
+ | <span class="comment">%in greater detail is on chapter 17.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 5. Scatterplot of entire signal data in 3D</span> | ||
+ | figure | ||
+ | scatter3(signals(1,:),signals(2,:),signals(3,:),pointsize,colour1,<span class="string">'filled'</span>) | ||
+ | title(<span class="string">'Interdonal Variation Represented By First Three Principal Components'</span>) | ||
+ | xlabel(<span class="string">'PC1'</span>) | ||
+ | ylabel(<span class="string">'PC2'</span>) | ||
+ | zlabel(<span class="string">'PC3'</span>) | ||
+ | correctedPosition = get(gcf,<span class="string">'Position'</span>) + [21 -125 0 0]; | ||
+ | fps = 60; sec = 5; | ||
+ | |||
+ | vidObj = VideoWriter(<span class="string">'newfile.avi'</span>); | ||
+ | vidObj.Quality = 100; | ||
+ | vidObj.FrameRate = fps; | ||
+ | |||
+ | open(vidObj); | ||
+ | <span class="keyword">for</span> i=1:fps*sec | ||
+ | camorbit(0.9,-0.1); | ||
+ | writeVideo(vidObj,getframe(gcf, correctedPosition)); | ||
+ | <span class="keyword">end</span> | ||
+ | close(vidObj); | ||
+ | <span class="comment">% Video animation of Interdonal variation along first three PCs.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 6. Comparing eigenvalues from PCA and SVD</span> | ||
+ | [COEFF,SCORE,latent]=pca(data'); <span class="comment">% Traspose data before plugging into function</span> | ||
+ | <span class="comment">% PCA function was applied to the normalised data to compare the</span> | ||
+ | <span class="comment">% eigenvalues from the covariance matrix diag(S) with latent.</span> | ||
+ | latent; <span class="comment">% Returns the eigenvalues of the covarance matrix.</span> | ||
+ | <span class="comment">% latent omits zero value eigenvalues.</span> | ||
+ | eigenSVD = diag(S).^2; | ||
+ | <span class="comment">%Both methods of analysis are expected to provide different principal</span> | ||
+ | <span class="comment">%components but the same eigenvalues. This is a check for consistency.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 7. Evaluation of variance coverage by principal components</span> | ||
+ | latentcov=cumsum(latent)./sum(latent); <span class="comment">% 98% of the variance is accounted for by first 3 PCs from PCA package.</span> | ||
+ | Scoverage=cumsum(diag(S))./sum(diag(S)); <span class="comment">% 76% of the var is accounted for by the first 3 PCs from svd package.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 8. Curating normalised data for CB003 donor</span> | ||
+ | CB003_dataN = array2table(dataN); | ||
+ | filename2 = <span class="string">'CB003Norm.xlsx'</span>; | ||
+ | writetable(CB003_dataN,filename2,<span class="string">'sheet'</span>,1); <span class="comment">%Used this newly created spreadsheet on Excel to</span> | ||
+ | <span class="comment">%manually cut out CB003 from the rest of the donors</span> | ||
+ | SheetCB3_2 = 2; | ||
+ | xlrange1= <span class="string">'A1:AM15'</span>; | ||
+ | CB003 = xlsread(filename2,SheetCB3_2,xlrange1); | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 9. Curating normalised data to for CB135 donor</span> | ||
+ | SheetCB135_3 = 3; | ||
+ | CB135 = xlsread(filename2,SheetCB135_3,xlrange1); | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 10. CB003 interdonal PCA analysis</span> | ||
+ | signalsCB003 = PC'*CB003; | ||
+ | figure | ||
+ | scatter(signalsCB003(1,:),signalsCB003(2,:),<span class="string">'filled'</span>)<span class="comment">%first row all columns,second row all columns.</span> | ||
+ | title(<span class="string">'CB003 Interdonal Score Plot Analysis'</span>) | ||
+ | xlabel(<span class="string">'PC1'</span>) | ||
+ | ylabel(<span class="string">'PC2'</span>) | ||
+ | <span class="comment">%This figure shows how much the principle components for the whole sample</span> | ||
+ | <span class="comment">%reflects on the particular CB003 donor in other words, the interdonor</span> | ||
+ | <span class="comment">%variation between CB003 and the rest of the samples.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 11. CB135 interdonal PCA analysis</span> | ||
+ | signalsCB135 = PC'*CB135; | ||
+ | figure | ||
+ | scatter(signalsCB135(1,:),signalsCB135(2,:)) | ||
+ | title(<span class="string">'CB135 interdonal score plot analysis'</span>) | ||
+ | xlabel(<span class="string">'PC1'</span>) | ||
+ | ylabel(<span class="string">'PC2'</span>) | ||
+ | <span class="comment">% Measuring the degradation of composites from donor CB135 against the PCs</span> | ||
+ | <span class="comment">% of entire sample.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 12. PCA Intravariation in CB003</span> | ||
+ | Z1 = CB003'/sqrt(N-1); | ||
+ | [u1,S1,PC1]= svd(Z1); <span class="comment">% Principal matrix made only by CB003 sample alone</span> | ||
+ | intrasignalCB3 = PC1'*CB003; | ||
+ | figure | ||
+ | scatter(intrasignalCB3(1,:),intrasignalCB3(2,:),<span class="string">'filled'</span>) | ||
+ | title(<span class="string">'Intravariation scoreplot of first two principal components of Donor CB003'</span>) | ||
+ | xlabel(<span class="string">'PC1'</span>) | ||
+ | ylabel(<span class="string">'PC2'</span>) | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 13. PCA Intravariation in CB135</span> | ||
+ | Z2 = CB135'/sqrt(N-1); | ||
+ | [u2,S2,PC2] = svd(Z2); | ||
+ | intrasignalCB135=PC2'*CB135; | ||
+ | figure | ||
+ | scatter(intrasignalCB135(1,:),intrasignalCB135(2,:)) | ||
+ | title(<span class="string">'Intravariation scoreplot of first two principal components of Donor CB135'</span>) | ||
+ | xlabel(<span class="string">'PC1'</span>) | ||
+ | ylabel(<span class="string">'PC2'</span>) | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 14. Factor loadings for PC produced from SVD</span> | ||
+ | <span class="comment">% This tells us how much each compound contributes to each of the primary</span> | ||
+ | <span class="comment">% three principal components given that PC1 accounts for 60% of the data</span> | ||
+ | <span class="comment">% according to the SVD reading on chapter 7.</span> | ||
+ | signalT = signals'; | ||
+ | figure | ||
+ | biplot(PC(:,1:2),<span class="string">'scores'</span>,signalT(:,1:2),<span class="string">'VarLabels'</span>,<span class="keyword">...</span> | ||
+ | {<span class="string">'Tetra'</span>,<span class="string">'Penta'</span>,<span class="string">'Hexa'</span>,<span class="string">'Palmitic'</span>,<span class="string">'Oliec'</span>,<span class="string">'Stearic'</span>,<span class="string">'Squalene'</span>,<span class="string">'C24'</span>,<span class="string">'C30:1'</span>,<span class="string">'C30:0'</span>,<span class="string">'CHO'</span>,<span class="string">'C32:1'</span>,<span class="string">'C32:0'</span>,<span class="string">'C34:1'</span>,<span class="string">'C34:0'</span>},<span class="string">'LineWidth'</span>,2) | ||
+ | <span class="comment">% (:,1:2) = all rows of first two columns--opposite to written algrebra</span> | ||
+ | title(<span class="string">'Biplot Of Finger Composite Contribution To First Two Principal Components [SVD]'</span>) | ||
+ | xlabel(<span class="string">'PC1'</span>) | ||
+ | ylabel(<span class="string">'PC2'</span>) | ||
+ | figure | ||
+ | biplot(PC(:,1:3),<span class="string">'scores'</span>,signalT(:,1:3),<span class="string">'VarLabels'</span>,<span class="keyword">...</span> | ||
+ | {<span class="string">'Tetra'</span>,<span class="string">'Penta'</span>,<span class="string">'Hexa'</span>,<span class="string">'Palmitic'</span>,<span class="string">'Oliec'</span>,<span class="string">'Stearic'</span>,<span class="string">'Squalene'</span>,<span class="string">'C24'</span>,<span class="string">'C30:1'</span>,<span class="string">'C30:0'</span>,<span class="string">'CHO'</span>,<span class="string">'C32:1'</span>,<span class="string">'C32:0'</span>,<span class="string">'C34:1'</span>,<span class="string">'C34:0'</span>}) | ||
+ | title(<span class="string">'Biplot Of Finger Composite Contribution To First Three Principal Components [SVD]'</span>) | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 15. Factor loadings for PC produced from PCA package</span> | ||
+ | figure | ||
+ | biplot(COEFF(:,1:2),<span class="string">'Scores'</span>,SCORE(:,1:2),<span class="string">'VarLabels'</span>,<span class="keyword">...</span> | ||
+ | {<span class="string">'Tetra'</span>,<span class="string">'Penta'</span>,<span class="string">'Hexa'</span>,<span class="string">'Palmitic'</span>,<span class="string">'Oliec'</span>,<span class="string">'Stearic'</span>,<span class="string">'Squalene'</span>,<span class="string">'C24'</span>,<span class="string">'C30:1'</span>,<span class="string">'C30:0'</span>,<span class="string">'CHO'</span>,<span class="string">'C32:1'</span>,<span class="string">'C32:0'</span>,<span class="string">'C34:1'</span>,<span class="string">'C34:0'</span>}) | ||
+ | title(<span class="string">'Biplot Of Finger Composite Contribution To First Two Principal Components [PCA]'</span>) | ||
+ | xlabel(<span class="string">'PC1'</span>) | ||
+ | ylabel(<span class="string">'PC2'</span>) | ||
+ | figure | ||
+ | biplot(COEFF(:,1:3),<span class="string">'Scores'</span>,SCORE(:,1:3),<span class="string">'VarLabels'</span>,<span class="keyword">...</span> | ||
+ | {<span class="string">'Tetra'</span>,<span class="string">'Penta'</span>,<span class="string">'Hexa'</span>,<span class="string">'Palmitic'</span>,<span class="string">'Oliec'</span>,<span class="string">'Stearic'</span>,<span class="string">'Squalene'</span>,<span class="string">'C24'</span>,<span class="string">'C30:1'</span>,<span class="string">'C30:0'</span>,<span class="string">'CHO'</span>,<span class="string">'C32:1'</span>,<span class="string">'C32:0'</span>,<span class="string">'C34:1'</span>,<span class="string">'C34:0'</span>}) | ||
+ | title(<span class="string">'Biplot Of Finger Composite Contribution To First Three Principal Components [PCA]'</span>) | ||
+ | xlabel(<span class="string">'PC1'</span>) | ||
+ | ylabel(<span class="string">'PC2'</span>) | ||
+ | zlabel(<span class="string">'PC3'</span>) | ||
+ | correctedPosition = get(gcf,<span class="string">'Position'</span>) + [21 -125 0 0]; | ||
+ | fps = 60; sec = 10; | ||
+ | |||
+ | vidObj = VideoWriter(<span class="string">'newfile.avi'</span>); | ||
+ | vidObj.Quality = 100; | ||
+ | vidObj.FrameRate = fps; | ||
+ | |||
+ | open(vidObj); | ||
+ | <span class="keyword">for</span> i=1:fps*sec | ||
+ | camorbit(0.9,-0.1); | ||
+ | writeVideo(vidObj,getframe(gcf, correctedPosition)); | ||
+ | <span class="keyword">end</span> | ||
+ | close(vidObj); | ||
+ | <span class="comment">%Results suggest Squalene consitutes 80% of the first PC and 20% of the second.</span> | ||
+ | <span class="comment">%Palmitic acid constitutes 65% of second PC and -40% of first.</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 16. PC1 Axis Comparison</span> | ||
+ | <span class="comment">%In order to view the relationship between time and squalene more clearly,</span> | ||
+ | <span class="comment">%The samples of each donor were grouped based on age and plotted against</span> | ||
+ | <span class="comment">%PC1 to see how the data aligns. This also aims to see whether or not</span> | ||
+ | <span class="comment">%Squalene breaksdown at a consistent rate across all donors.</span> | ||
+ | |||
+ | <span class="comment">% Day 0</span> | ||
+ | Sheet_time_0 = 6; | ||
+ | xlranget0= <span class="string">'B2:V16'</span>; | ||
+ | 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; | ||
+ | |||
+ | <span class="comment">% Day 2</span> | ||
+ | Sheet_time_2 = 6; | ||
+ | xlranget2= <span class="string">'B19:V33'</span>; | ||
+ | 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; | ||
+ | |||
+ | <span class="comment">% Day 5</span> | ||
+ | Sheet_time_5 = 6; | ||
+ | xlranget5= <span class="string">'B36:V50'</span>; | ||
+ | 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; | ||
+ | |||
+ | <span class="comment">% Day 7</span> | ||
+ | Sheet_time_7 = 6; | ||
+ | xlranget7= <span class="string">'B53:V67'</span>; | ||
+ | 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; | ||
+ | |||
+ | <span class="comment">% Day 9</span> | ||
+ | Sheet_time_9 = 6; | ||
+ | xlranget9= <span class="string">'B70:V84'</span>; | ||
+ | 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; | ||
+ | |||
+ | <span class="comment">% Day 12</span> | ||
+ | Sheet_time_12 = 6; | ||
+ | xlranget12= <span class="string">'B87:V101'</span>; | ||
+ | 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; | ||
+ | |||
+ | <span class="comment">% Day 14</span> | ||
+ | Sheet_time_14 = 6; | ||
+ | xlranget14= <span class="string">'B104:V118'</span>; | ||
+ | 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; | ||
+ | |||
+ | <span class="comment">% Day 16</span> | ||
+ | Sheet_time_16 = 6; | ||
+ | xlranget16= <span class="string">'B121:V135'</span>; | ||
+ | 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; | ||
+ | |||
+ | <span class="comment">% Day 19</span> | ||
+ | Sheet_time_19 = 6; | ||
+ | xlranget19= <span class="string">'B138:V152'</span>; | ||
+ | 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; | ||
+ | |||
+ | <span class="comment">% Day 21</span> | ||
+ | Sheet_time_21 = 6; | ||
+ | xlranget21= <span class="string">'B155:V169'</span>; | ||
+ | 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; | ||
+ | |||
+ | <span class="comment">% Day 23</span> | ||
+ | Sheet_time_23 = 6; | ||
+ | xlranget23= <span class="string">'B172:V186'</span>; | ||
+ | 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; | ||
+ | |||
+ | <span class="comment">% Day 26</span> | ||
+ | Sheet_time_26 = 6; | ||
+ | xlranget26= <span class="string">'B187:V203'</span>; | ||
+ | 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; | ||
+ | |||
+ | <span class="comment">% Day 28</span> | ||
+ | Sheet_time_28 = 6; | ||
+ | xlranget28= <span class="string">'B155:V169'</span>; | ||
+ | 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; | ||
+ | |||
+ | |||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 16.1 Interdonal Alignment Of Fingerprint Sample Age Along First Principal Alignment Axis</span> | ||
+ | |||
+ | 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 <span class="string">on</span> | ||
+ | scatter(signals_t_28(1,:),spacing12,50,col13,<span class="string">'filled'</span>); <span class="comment">% day 28</span> | ||
+ | scatter(signals_t_26(1,:),spacing11,50,col12,<span class="string">'filled'</span>); <span class="comment">% day 26</span> | ||
+ | scatter(signals_t_23(1,:),spacing10,50,col11,<span class="string">'filled'</span>); <span class="comment">% day 23</span> | ||
+ | scatter(signals_t_21(1,:),spacing9,50,col10,<span class="string">'filled'</span>); <span class="comment">% day 21</span> | ||
+ | scatter(signals_t_19(1,:),spacing8,50,col9,<span class="string">'filled'</span>); <span class="comment">% day 19</span> | ||
+ | scatter(signals_t_16(1,:),spacing7,50,col8,<span class="string">'filled'</span>); <span class="comment">% day 16</span> | ||
+ | scatter(signals_t_14(1,:),spacing6,50,col7,<span class="string">'filled'</span>); <span class="comment">% day 14</span> | ||
+ | scatter(signals_t_12(1,:),spacing5,50,col6,<span class="string">'filled'</span>); <span class="comment">% day 12</span> | ||
+ | scatter(signals_t_9(1,:),spacing4,50,col5,<span class="string">'filled'</span>); <span class="comment">% day 9</span> | ||
+ | scatter(signals_t_7(1,:),spacing3,50,col4,<span class="string">'filled'</span>); <span class="comment">% day 7</span> | ||
+ | scatter(signals_t_5(1,:),spacing2,50,col3,<span class="string">'filled'</span>); <span class="comment">% day 5</span> | ||
+ | scatter(signals_t_2(1,:),spacing1,50,col2,<span class="string">'filled'</span>); <span class="comment">% day 2</span> | ||
+ | scatter(signals_t_0(1,:),spacing,50,col1,<span class="string">'filled'</span>); <span class="comment">% day 0</span> | ||
+ | hold <span class="string">off</span> | ||
+ | set(gca,<span class="string">'YTick'</span>,[],<span class="string">'XTick'</span>,[]); | ||
+ | title(<span class="string">'Alignment of Aged Fingerprint Data with respect to First Principal Component Axis'</span>); | ||
+ | xlabel(<span class="string">'PC1'</span>); | ||
+ | legend(<span class="string">'day 28'</span>,<span class="string">'day 26'</span>,<span class="string">'day 23'</span>,<span class="string">'day 21'</span>,<span class="string">'day 19'</span>,<span class="string">'day 16'</span>,<span class="string">'day 14'</span>,<span class="string">'day 12'</span>,<span class="string">'day 9'</span>,<span class="string">'day 7'</span>,<span class="string">'day 5'</span>,<span class="string">'day 2'</span>,<span class="string">'day 0'</span>); | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 16.2 Intradonal Alignment against PC1</span> | ||
+ | <span class="comment">% CB003</span> | ||
+ | <span class="comment">% Day 0</span> | ||
+ | Sheet_CB3_0 = 2; | ||
+ | xlrangeCB3_0= <span class="string">'B2:D16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 2</span> | ||
+ | Sheet_cb3_2 = 2; | ||
+ | xlrangeCB3_2= <span class="string">'E2:G16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 5</span> | ||
+ | Sheet_cb3_5 = 2; | ||
+ | xlrangeCB3_5= <span class="string">'H2:J16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 7</span> | ||
+ | Sheet_cb3_7 = 2; | ||
+ | xlrangeCB_7= <span class="string">'K2:M16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 9</span> | ||
+ | Sheet_cb3_9 = 2; | ||
+ | xlrangeCB_9= <span class="string">'N2:P16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 12</span> | ||
+ | Sheet_cb3_12 = 2; | ||
+ | xlrangeCB12= <span class="string">'Q2:S16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 14</span> | ||
+ | Sheet_CB3_14 = 2; | ||
+ | xlrangeCB14= <span class="string">'T2:V16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 16</span> | ||
+ | Sheet_CB3_16 = 2; | ||
+ | xlrangeCB16= <span class="string">'W2:Y16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 19</span> | ||
+ | Sheet_CB3_19 = 2; | ||
+ | xlrangeCB19= <span class="string">'Z2:AB16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 21</span> | ||
+ | Sheet_CB3_21 = 2; | ||
+ | xlrangeCB21= <span class="string">'AC2:AE16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 23</span> | ||
+ | Sheet_CB3_23 = 2; | ||
+ | xlrangeCB23= <span class="string">'AF2:AH16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 26</span> | ||
+ | Sheet_CB3_26 = 2; | ||
+ | xlrangeCB26= <span class="string">'AI2:AK16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 28</span> | ||
+ | Sheet_CB3_28 = 2; | ||
+ | xlrangeCB28= <span class="string">'AL2:AN16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 16.3</span> | ||
+ | <span class="comment">%Intraspecific CB003 PC1 Alignment</span> | ||
+ | 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 <span class="string">on</span> | ||
+ | scatter(signals_cb3_28(1,:),spacing12,50,col13,<span class="string">'filled'</span>); <span class="comment">% day 28</span> | ||
+ | scatter(signals_cb3_26(1,:),spacing11,50,col12,<span class="string">'filled'</span>); <span class="comment">% day 26</span> | ||
+ | scatter(signals_cb3_23(1,:),spacing10,50,col11,<span class="string">'filled'</span>); <span class="comment">% day 23</span> | ||
+ | scatter(signals_cb3_21(1,:),spacing9,50,col10,<span class="string">'filled'</span>); <span class="comment">% day 21</span> | ||
+ | scatter(signals_cb3_19(1,:),spacing8,50,col9,<span class="string">'filled'</span>); <span class="comment">% day 19</span> | ||
+ | scatter(signals_cb3_16(1,:),spacing7,50,col8,<span class="string">'filled'</span>); <span class="comment">% day 16</span> | ||
+ | scatter(signals_cb3_14(1,:),spacing6,50,col7,<span class="string">'filled'</span>); <span class="comment">% day 14</span> | ||
+ | scatter(signals_cb3_12(1,:),spacing5,50,col6,<span class="string">'filled'</span>); <span class="comment">% day 12</span> | ||
+ | scatter(signals_cb3_9(1,:),spacing4,50,col5,<span class="string">'filled'</span>); <span class="comment">% day 9</span> | ||
+ | scatter(signals_cb3_7(1,:),spacing3,50,col4,<span class="string">'filled'</span>); <span class="comment">% day 7</span> | ||
+ | scatter(signals_cb3_5(1,:),spacing2,50,col3,<span class="string">'filled'</span>); <span class="comment">% day 5</span> | ||
+ | scatter(signals_cb3_2(1,:),spacing1,50,col2,<span class="string">'filled'</span>); <span class="comment">% day 2</span> | ||
+ | scatter(signals_cb3_0(1,:),spacing,50,col1,<span class="string">'filled'</span>); <span class="comment">% day 0</span> | ||
+ | hold <span class="string">off</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 16.31 Donor CB135 PC1 Alignment</span> | ||
+ | <span class="comment">% CB135</span> | ||
+ | <span class="comment">% Day 0</span> | ||
+ | Sheet_CB135_0 = 7; | ||
+ | xlrangeCB3_0= <span class="string">'B2:D16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 2</span> | ||
+ | Sheet_cb3_2 = 2; | ||
+ | xlrangeCB3_2= <span class="string">'E2:G16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 5</span> | ||
+ | Sheet_cb3_5 = 7; | ||
+ | xlrangeCB3_5= <span class="string">'H2:J16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 7</span> | ||
+ | Sheet_cb3_7 = 7; | ||
+ | xlrangeCB_7= <span class="string">'K2:M16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 9</span> | ||
+ | Sheet_cb3_9 = 7; | ||
+ | xlrangeCB_9= <span class="string">'N2:P16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 12</span> | ||
+ | Sheet_cb3_12 = 7; | ||
+ | xlrangeCB12= <span class="string">'Q2:S16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 14</span> | ||
+ | Sheet_CB3_14 = 7; | ||
+ | xlrangeCB14= <span class="string">'T2:V16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 16</span> | ||
+ | Sheet_CB3_16 = 7; | ||
+ | xlrangeCB16= <span class="string">'W2:Y16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 19</span> | ||
+ | Sheet_CB3_19 = 7; | ||
+ | xlrangeCB19= <span class="string">'Z2:AB16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 21</span> | ||
+ | Sheet_CB3_21 = 7; | ||
+ | xlrangeCB21= <span class="string">'AC2:AE16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 23</span> | ||
+ | Sheet_CB3_23 = 7; | ||
+ | xlrangeCB23= <span class="string">'AF2:AH16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 26</span> | ||
+ | Sheet_CB3_26 = 7; | ||
+ | xlrangeCB26= <span class="string">'AI2:AK16'</span>; | ||
+ | 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; | ||
+ | <span class="comment">% Day 28</span> | ||
+ | Sheet_CB3_28 = 7; | ||
+ | xlrangeCB28= <span class="string">'AL2:AN16'</span>; | ||
+ | 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 <span class="string">on</span> | ||
+ | scatter(signals_cb3_28(1,:),spacing12,50,col13,<span class="string">'filled'</span>); <span class="comment">% day 28</span> | ||
+ | scatter(signals_cb3_26(1,:),spacing11,50,col12,<span class="string">'filled'</span>); <span class="comment">% day 26</span> | ||
+ | scatter(signals_cb3_23(1,:),spacing10,50,col11,<span class="string">'filled'</span>); <span class="comment">% day 23</span> | ||
+ | scatter(signals_cb3_21(1,:),spacing9,50,col10,<span class="string">'filled'</span>); <span class="comment">% day 21</span> | ||
+ | scatter(signals_cb3_19(1,:),spacing8,50,col9,<span class="string">'filled'</span>); <span class="comment">% day 19</span> | ||
+ | scatter(signals_cb3_16(1,:),spacing7,50,col8,<span class="string">'filled'</span>); <span class="comment">% day 16</span> | ||
+ | scatter(signals_cb3_14(1,:),spacing6,50,col7,<span class="string">'filled'</span>); <span class="comment">% day 14</span> | ||
+ | scatter(signals_cb3_12(1,:),spacing5,50,col6,<span class="string">'filled'</span>); <span class="comment">% day 12</span> | ||
+ | scatter(signals_cb3_9(1,:),spacing4,50,col5,<span class="string">'filled'</span>); <span class="comment">% day 9</span> | ||
+ | scatter(signals_cb3_7(1,:),spacing3,50,col4,<span class="string">'filled'</span>); <span class="comment">% day 7</span> | ||
+ | scatter(signals_cb3_5(1,:),spacing2,50,col3,<span class="string">'filled'</span>); <span class="comment">% day 5</span> | ||
+ | scatter(signals_cb3_2(1,:),spacing1,50,col2,<span class="string">'filled'</span>); <span class="comment">% day 2</span> | ||
+ | scatter(signals_cb3_0(1,:),spacing,50,col1,<span class="string">'filled'</span>); <span class="comment">% day 0</span> | ||
+ | hold <span class="string">off</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% Section 17. Age Curves Of Major Composites Found In Principal Components For Each Donor</span> | ||
+ | <span class="comment">% Donor CB003</span> | ||
+ | t = [ 0 2 5 7 9 12 14 16 19 21 23 26 28]; | ||
+ | xlrange3 =<span class="string">'B21:N21'</span>; <span class="comment">%sq</span> | ||
+ | xlrange4 =<span class="string">'B22:N22'</span>; <span class="comment">%palm</span> | ||
+ | xlrange5 =<span class="string">'B23:N23'</span>; <span class="comment">%hexa</span> | ||
+ | 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 <span class="string">on</span> | ||
+ | a1 = plot(t,a,<span class="string">'r'</span>); | ||
+ | a2 = plot(t,b,<span class="string">'b'</span>); | ||
+ | a3 = plot(t,c,<span class="string">'g'</span>); | ||
+ | errorbar(t,a,e,<span class="string">'r'</span>); | ||
+ | errorbar(t,b,e1,<span class="string">'b'</span>); | ||
+ | errorbar(t,c,e2,<span class="string">'g'</span>); | ||
+ | hold <span class="string">off</span> | ||
+ | legend([a1 a2 a3],<span class="string">'Squalene'</span>,<span class="string">'Palmitic acid'</span>,<span class="string">'Hexadecenoic acid'</span>); | ||
+ | title(<span class="string">'Degradation Principle Composites Against Time For CB003 Donor'</span>); | ||
+ | xlabel(<span class="string">'Time (days)'</span>); | ||
+ | ylabel(<span class="string">'Normalised Chromatgram Values'</span>); | ||
+ | <span class="comment">% Donor CA006</span> | ||
+ | xlrange6 =<span class="string">'B26:N26'</span>; <span class="comment">%hexa</span> | ||
+ | xlrange7 =<span class="string">'B27:N27'</span>; <span class="comment">%palm</span> | ||
+ | xlrange8 =<span class="string">'B28:N28'</span>; <span class="comment">%sq</span> | ||
+ | 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 <span class="string">on</span> | ||
+ | aa1 = plot(t,aa,<span class="string">'r'</span>); | ||
+ | aa2 = plot(t,bb,<span class="string">'b'</span>); | ||
+ | aa3 = plot(t,cc,<span class="string">'g'</span>); | ||
+ | errorbar(t,aa,ee,<span class="string">'r'</span>); | ||
+ | errorbar(t,bb,ee1,<span class="string">'b'</span>); | ||
+ | errorbar(t,cc,ee2,<span class="string">'g'</span>); | ||
+ | hold <span class="string">off</span> | ||
+ | legend([aa1 aa2 aa3],<span class="string">'Squalene'</span>,<span class="string">'Palmitic acid'</span>,<span class="string">'Hexadecenoic acid'</span>); | ||
+ | title(<span class="string">'Degradation Principle Composites Against Time For CA006 Donor'</span>); | ||
+ | xlabel(<span class="string">'Time (days)'</span>); | ||
+ | ylabel(<span class="string">'Normalised Chromatgram Values'</span>); | ||
+ | <span class="comment">% CB033</span> | ||
+ | xlrange9 =<span class="string">'B31:N31'</span>; <span class="comment">%hexa</span> | ||
+ | xlrange10 =<span class="string">'B32:N32'</span>; <span class="comment">%palm</span> | ||
+ | xlrange11 =<span class="string">'B33:N33'</span>; <span class="comment">%sq</span> | ||
+ | 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 <span class="string">on</span> | ||
+ | aaa1 = plot(t,aaa,<span class="string">'r'</span>); | ||
+ | aaa2 = plot(t,bbb,<span class="string">'b'</span>); | ||
+ | aaa3 = plot(t,ccc,<span class="string">'g'</span>); | ||
+ | errorbar(t,aaa,eee,<span class="string">'r'</span>); | ||
+ | errorbar(t,bbb,eee1,<span class="string">'b'</span>); | ||
+ | errorbar(t,ccc,eee2,<span class="string">'g'</span>); | ||
+ | hold <span class="string">off</span> | ||
+ | legend([aaa1 aaa2 aaa3],<span class="string">'Squalene'</span>,<span class="string">'Palmitic acid'</span>,<span class="string">'Hexadecenoic acid'</span>); | ||
+ | title(<span class="string">'Degradation Principle Composites Against Time For CB033 Donor'</span>); | ||
+ | xlabel(<span class="string">'Time (days)'</span>); | ||
+ | ylabel(<span class="string">'Normalised Chromatgram Values'</span>); | ||
+ | <span class="comment">%DA080</span> | ||
+ | xlrange12 =<span class="string">'B36:N36'</span>; <span class="comment">%hexa</span> | ||
+ | xlrange13 =<span class="string">'B37:N37'</span>; <span class="comment">%palm</span> | ||
+ | xlrange14 =<span class="string">'B38:N38'</span>; <span class="comment">%sq</span> | ||
+ | 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 <span class="string">on</span> | ||
+ | aaaa1 = plot(t,aaaa,<span class="string">'r'</span>); | ||
+ | aaaa2 = plot(t,bbbb,<span class="string">'b'</span>); | ||
+ | aaaa3 = plot(t,cccc,<span class="string">'g'</span>); | ||
+ | errorbar(t,aaaa,eeee,<span class="string">'r'</span>); | ||
+ | errorbar(t,bbbb,eeee1,<span class="string">'b'</span>); | ||
+ | errorbar(t,cccc,eeee2,<span class="string">'g'</span>); | ||
+ | hold <span class="string">off</span> | ||
+ | legend([aaaa1 aaaa2 aaaa3],<span class="string">'Squalene'</span>,<span class="string">'Palmitic acid'</span>,<span class="string">'Hexadecenoic acid'</span>); | ||
+ | title(<span class="string">'Degradation Principle Composites Against Time For DA080 Donor'</span>); | ||
+ | xlabel(<span class="string">'Time (days)'</span>); | ||
+ | ylabel(<span class="string">'Normalised Chromatgram Values'</span>); | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">%</span> | ||
+ | <span class="comment">% END OF FILE</span> | ||
+ | </pre> | ||
</div> | </div> | ||
</div> | </div> |
Revision as of 08:40, 15 September 2015
Dry Lab
Appendix 2: Fingerprint Ageing Code
![](https://static.igem.org/mediawiki/2015/0/0c/TeamDundee-Keyboard-Tiny.png)
Principal Component Analysis Code
Lorem ipsum dolor sit amet, nostrud maiestatis quaerendum ne sed. Reque possit ne sea. Te dico labitur mediocritatem ius. Error timeam noluisse eos ad, eam ne magna meliore contentiones, nec ei volumus persecuti. Dicit animal definitionem et mel, nonumy tacimates nec in. Vis mucius periculis at. At est vidit scripserit repudiandae, agam porro sea ne. Sea et stet tibique praesent, vim et legere aperiri. Quo doming vocibus eleifend no. Cu vis partem graeci facilisis. Falli inciderint mei no. Assentior suscipiantur mea id. Vis quas electram prodesset cu, choro omnium conclusionemque an his. Vis latine equidem perfecto ad.
% 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 analyzed 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 substracting 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 a %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 %feesiblity 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 Chapter 14 of code), %How much do the first two PCs represent the total variance of the dataset? %(See chapter 7 of code), and if fingerprints from different donors age the %at the same rate? (Chapter 4) % % % Section 4. Scoreplot of composite degraduation 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 diffulcult 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 intraspecificity. 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 on chapter 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'); % Traspose 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 covarance 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 analysis 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 analysis 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 breaksdown 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 Chromatgram 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 Chromatgram 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 Chromatgram 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 Chromatgram 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 1 (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