Difference between revisions of "Team:USTC/Software"

Line 69: Line 69:
 
<p>This program is used to simulate fringes pattern deliverd by film I.</p>
 
<p>This program is used to simulate fringes pattern deliverd by film I.</p>
 
<p>Code:</p>
 
<p>Code:</p>
<pre><code>function drawndh(r,h,t,n) %r is radius of film,h is the distance of deformation,t is the drift angle of film,n is pixel number
+
<pre><code id="code">function drawndh(r,h,t,n) %r is radius of film,h is the distance of deformation,t is the drift angle of film,n is pixel number
 
wl=6.5e-7; %wave length
 
wl=6.5e-7; %wave length
 
R=r.^2/(2*h);
 
R=r.^2/(2*h);
Line 85: Line 85:
 
<p>This program is used to simulate fringes pattern deliverd by film II.</p>
 
<p>This program is used to simulate fringes pattern deliverd by film II.</p>
 
<p>Code</p>
 
<p>Code</p>
<pre><code>function drawfr(a,b,h,n)%a is the angle between film and x axis, b is the angle between film and y axis, h is the distance of film deformation, n is the pixel number
+
<pre><code id="code">function drawfr(a,b,h,n)%a is the angle between film and x axis, b is the angle between film and y axis, h is the distance of film deformation, n is the pixel number
 
[X,Y]=meshgrid(linspace(-0.003,0.003,n),linspace(-0.003,0.003,n));
 
[X,Y]=meshgrid(linspace(-0.003,0.003,n),linspace(-0.003,0.003,n));
 
wl=6.5e-7;
 
wl=6.5e-7;
Line 99: Line 99:
 
<p>Using this code, we are able to capture some important parameters in Film I.</p>
 
<p>Using this code, we are able to capture some important parameters in Film I.</p>
 
<p>Code</p>
 
<p>Code</p>
<pre><code>function ms3=solvendh(X,nx,ny,n,dx,dy)%nx is the number of fringes on x axis,ny is the number of fringes on y axis,n is the number of fringes on diag,dx is the x length of CCD,dx is the x length of CCD.
+
<pre><code id="code">function ms3=solvendh(X,nx,ny,n,dx,dy)%nx is the number of fringes on x axis,ny is the number of fringes on y axis,n is the number of fringes on diag,dx is the x length of CCD,dx is the x length of CCD.
 
x=X(1);
 
x=X(1);
 
y=X(2);
 
y=X(2);
Line 113: Line 113:
 
<p>This is the final program used to get our NDM calibration. Based on this software program, we are able to count the number of bright fringes. As a matter of fact, the variation of bright fringes is the key breakthrough to antibiotic analysis.</p>
 
<p>This is the final program used to get our NDM calibration. Based on this software program, we are able to count the number of bright fringes. As a matter of fact, the variation of bright fringes is the key breakthrough to antibiotic analysis.</p>
 
<p>Code</p>
 
<p>Code</p>
<pre><code>function seeim(i)
+
<pre><code id="code">function seeim(i)
 
name=num2str(i);
 
name=num2str(i);
 
I=imread(name,'pnm');
 
I=imread(name,'pnm');
Line 119: Line 119:
 
imshow(G);
 
imshow(G);
 
</code></pre><p>Demo<br><img src="https://static.igem.org/mediawiki/2015/2/2d/20150919072.png" alt="Figure 4: Checking figure program"></p>
 
</code></pre><p>Demo<br><img src="https://static.igem.org/mediawiki/2015/2/2d/20150919072.png" alt="Figure 4: Checking figure program"></p>
<pre><code>function A=getfr(i)
+
<pre><code id="code">function A=getfr(i)
 
name=num2str(i);
 
name=num2str(i);
 
I=imread(name,'pnm');
 
I=imread(name,'pnm');
Line 136: Line 136:
 
end
 
end
 
A=r;
 
A=r;
</code></pre><pre><code>function M=getfrs(i)
+
</code></pre><pre><code id="code">function M=getfrs(i)
 
A=getfr(i);
 
A=getfr(i);
 
t=1:480;
 
t=1:480;
Line 145: Line 145:
 
<p><img src="https://static.igem.org/mediawiki/2015/c/c1/20150919073.png" alt="Figure 5: Fringes counting program running result"></p>
 
<p><img src="https://static.igem.org/mediawiki/2015/c/c1/20150919073.png" alt="Figure 5: Fringes counting program running result"></p>
 
<p>To get a series of results, this program is required.</p>
 
<p>To get a series of results, this program is required.</p>
<pre><code>function N=getpkss(i,j)
+
<pre><code id="code">function N=getpkss(i,j)
 
B=zeros(j-i+1,1);
 
B=zeros(j-i+1,1);
 
for m=i:j
 
for m=i:j
Line 156: Line 156:
 
</code></pre><p>Demo</p>
 
</code></pre><p>Demo</p>
 
<p>ans =</p>
 
<p>ans =</p>
<pre><code>78
+
<pre><code id="code">78
 
80
 
80
 
77
 
77
Line 210: Line 210:
 
<p>This program is used to count the total number of bacteria.</p>
 
<p>This program is used to count the total number of bacteria.</p>
 
<p>Code</p>
 
<p>Code</p>
<pre><code>function a=shujun(i)
+
<pre><code id="code">function a=shujun(i)
 
name=num2str(i);
 
name=num2str(i);
 
I=imread(name,'jpg');
 
I=imread(name,'jpg');
Line 224: Line 224:
 
</code></pre><p>Demo</p>
 
</code></pre><p>Demo</p>
 
<p>input image:<br><img src="https://static.igem.org/mediawiki/2015/0/0e/20150919074.jpg" alt="Figure 6: Adhesion Assay image"><br>output result<br>ans =<br>    865</p>
 
<p>input image:<br><img src="https://static.igem.org/mediawiki/2015/0/0e/20150919074.jpg" alt="Figure 6: Adhesion Assay image"><br>output result<br>ans =<br>    865</p>
<pre><code>function A=mulshu(m)
+
<pre><code id="code">function A=mulshu(m)
 
A=zeros(m,1);
 
A=zeros(m,1);
 
for i=1:m
 
for i=1:m
Line 235: Line 235:
 
<p>This program is used to count the total number of moving bacteria. Along with bacterial counting program, we finally got the mechanism of polylysine interaction.</p>
 
<p>This program is used to count the total number of moving bacteria. Along with bacterial counting program, we finally got the mechanism of polylysine interaction.</p>
 
<p>Code</p>
 
<p>Code</p>
<pre><code>function b=act(m,n)
+
<pre><code id="code">function b=act(m,n)
 
s1=num2str(m);
 
s1=num2str(m);
 
s2=num2str(n);
 
s2=num2str(n);
Line 270: Line 270:
 
<h4 id="Bacteria-movement-number-Time-curve" class="scrollspy">Bacteria movement number-Time curve</h4>
 
<h4 id="Bacteria-movement-number-Time-curve" class="scrollspy">Bacteria movement number-Time curve</h4>
 
<p>Coding</p>
 
<p>Coding</p>
<pre><code>function drawBMT(c,b,m0,k)
+
<pre><code id="code">function drawBMT(c,b,m0,k)
 
t=linspace(0,100,101);
 
t=linspace(0,100,101);
 
M=c*(1-exp(-b*t))*m0.*exp(-k*t);
 
M=c*(1-exp(-b*t))*m0.*exp(-k*t);
Line 308: Line 308:
 
<p>This program is used to predict the advantages of ROSE construction. We successfully demonstrate our ROSE will be able to amplify fluorescence siganl.</p>
 
<p>This program is used to predict the advantages of ROSE construction. We successfully demonstrate our ROSE will be able to amplify fluorescence siganl.</p>
 
<p>Code</p>
 
<p>Code</p>
<pre><code>clear all
+
<pre><code id="code">clear all
 
R=R,k=k,k1=k1,k2=k2,k3=k3,k4=k4,k5=k5,k6=k6,k7=k7,k0=k0; %define the constant
 
R=R,k=k,k1=k1,k2=k2,k3=k3,k4=k4,k5=k5,k6=k6,k7=k7,k0=k0; %define the constant
 
t=linspace(0,10); %detecting time range
 
t=linspace(0,10); %detecting time range
Line 339: Line 339:
 
<script type="text/javascript" src="https://2015.igem.org/Template:USTC/js/codemirror?action=raw&amp;ctype=text/javascript"></script>
 
<script type="text/javascript" src="https://2015.igem.org/Template:USTC/js/codemirror?action=raw&amp;ctype=text/javascript"></script>
 
<script type="text/javascript" src="https://2015.igem.org/Template:USTC/js/octave?action=raw&amp;ctype=text/javascript"></script>
 
<script type="text/javascript" src="https://2015.igem.org/Template:USTC/js/octave?action=raw&amp;ctype=text/javascript"></script>
 +
<script>
 +
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 +
        mode: {name: "octave",
 +
              version: 2,
 +
              singleLineStringErrors: false},
 +
        lineNumbers: true,
 +
        indentUnit: 4,
 +
        matchBrackets: true
 +
      });
 +
    </script>
 
</html>
 
</html>
 
{{USTC/footer}}
 
{{USTC/footer}}

Revision as of 23:22, 18 September 2015

In this section, we will introduce all the software program we used when processing our modeling and experimental data. Through our modeling, many complicated processdures are simply omitted by our convenient programs.

In general, our software programs are used in several sections,

  • Fringes Analysis, analysis of interference pattern.
  • Adhesion Dynamics, a series of programs relating to bacteria adhesion dynamics.
  • Rose Prediction, which calculate the advantages of our ROSE improvement.

All software of our project, you can download them at Github:2015USTCiGEM. All codes are based on

Fringes Pattern Simulation-Film I

This program is used to simulate fringes pattern deliverd by film I.

Code:

function drawndh(r,h,t,n) %r is radius of film,h is the distance of deformation,t is the drift angle of film,n is pixel number
wl=6.5e-7; %wave length
R=r.^2/(2*h);
[x,y]=meshgrid(linspace(-0.004,0.004,n),linspace(-0.004,0.004,n));
r2=x.^2+y.^2;
delta=pi*r2/(R*wl)-2*pi*y*sin(t)/wl;
I=abs(sin(delta).^2);
imshow(I);
end

Demo
Figure 1: Film II deformation simulation result

After the formation of demo, we are able to recongize the real situation in our pre-experiment.

Fringes Pattern Simulation-Film II

This program is used to simulate fringes pattern deliverd by film II.

Code

function drawfr(a,b,h,n)%a is the angle between film and x axis, b is the angle between film and y axis, h is the distance of film deformation, n is the pixel number
[X,Y]=meshgrid(linspace(-0.003,0.003,n),linspace(-0.003,0.003,n));
wl=6.5e-7;
L=2*(X.*tan(0.01)+Y.*tan(0.01));
delta=2*pi*L/wl;
I=1+cos(delta);
imshow(I)
end

Demo
Figure 2 :Film II deformation simulation result

Film I Fringes Analysis

Using this code, we are able to capture some important parameters in Film I.

Code

function ms3=solvendh(X,nx,ny,n,dx,dy)%nx is the number of fringes on x axis,ny is the number of fringes on y axis,n is the number of fringes on diag,dx is the x length of CCD,dx is the x length of CCD.
x=X(1);
y=X(2);
z=X(3);
l=1.2e-4;
ms3(1)=(2*(z+nx)*l)^0.5-(2*z*l)^0.5-((x+dx)^2+y^2)^0.5+(x^2+y^2)^0.5;
ms3(2)=(2*(z+ny)*l)^0.5-(2*z*l)^0.5-(x^2+(y+dy)^2)^0.5+(x^2+y^2)^0.5;
ms3(3)=(2*(z+n)*l)^0.5-(2*z*l)^0.5-((x+dx)^2+(y+dy)^2)^0.5+(x^2+y^2)^0.5;

Demo
Figure 3 : Film I Fringes analysis running result

Film II Fringes Analysis-Fringes number analysis

This is the final program used to get our NDM calibration. Based on this software program, we are able to count the number of bright fringes. As a matter of fact, the variation of bright fringes is the key breakthrough to antibiotic analysis.

Code

function seeim(i)
name=num2str(i);
I=imread(name,'pnm');
G=rgb2gray(I);
imshow(G);

Demo
Figure 4: Checking figure program

function A=getfr(i)
name=num2str(i);
I=imread(name,'pnm');
G=rgb2gray(I);
G1=medfilt2(G);
[x,y]=size(G1);
r=zeros(x,1);
for m=1:20
    p=G1(:,x-m+1);
    p=double(p);
    r=r+p;
end
[a,b]=size(r);
for m=1:b-1
    r(m,1)=(r(m-1,1)+r(m,1)+r(m+1,1));
end
A=r;
function M=getfrs(i)
A=getfr(i);
t=1:480;
[pksa,locsa]=findpeaks(A,'minpeakdistance',3);plot(t,A,'b',locsa,pksa,'bo');
[a,k]=size(pksa);
M=a;

Running result
ans =
78

Figure 5: Fringes counting program running result

To get a series of results, this program is required.

function N=getpkss(i,j)
B=zeros(j-i+1,1);
for m=i:j
    A=getfr(m);
    [pksa,locsa]=findpeaks(A,'minpeakdistance',3);
    [a,k]=size(pksa);
    B(m-i+1,1)=a;
end
N=B;

Demo

ans =

78
80
77
76
75
79
81
80
75
80
82
82
81
78
79
82
81
81
83
81
79

During analysis of ahdesion assay results, we are quite annoyed about counting total bacteria number and moving bacteria number, which is really important for mechanism analysis and results determination. Consequently, this part explains how we efficiently accomplished these tough work based on our software.

Bacteria counting program

This program is used to count the total number of bacteria.

Code

function a=shujun(i)
name=num2str(i);
I=imread(name,'jpg');
L=graythresh(I);%get the self-adapting threshold
G=im2bw(I,0.3);%image binaryzation with special threshold
W1=~G;
W2=bwmorph(W1,'majority',20);%mathematical morphology operations
W3=medfilt2(W2,[10,10]);%filtering
W4=bwareaopen(W3,40);%delete small area to reduce error noises
[labeled,num]=bwlabel(W4,4);%counting number of objects
a=num;
end

Demo

input image:
Figure 6: Adhesion Assay image
output result
ans =
865

function A=mulshu(m)
A=zeros(m,1);
for i=1:m
    A(i,1)=shujun(i);
end

Moving Bacteria Counting Program

This program is used to count the total number of moving bacteria. Along with bacterial counting program, we finally got the mechanism of polylysine interaction.

Code

function b=act(m,n)
s1=num2str(m);
s2=num2str(n);
I1=imread(s1,'jpg');
I2=imread(s2,'jpg');
G=I1-I2;
b=shujun(G);
end
function A=mulact(m)
A=zeros(m,1);
for i=1:m
    name1=num2str(i);
    name2=num2str(i+1);
    I1=imread(name1,'jpg');
    I2=imread(name2,'jpg');
    c=act(I1,I2);
    A(i,1)=c;
end

Demo

ans =
405

Bacteria total number-time curve

Coding

function drawBT1(Ka,Kd,C,Vz,sigma0)%Ka is the adhesive rate of bacteria, Kd is the drop rate of bacteria, C is the density of bacteria solution,Vz is the velocity of bacteria,sigma0 is the maximum density of baacteria on surface
t=linspace(0,100,101);
K=Ka*C*Vz/(Kd*sigma0+Ka*C*Vz);
sigma=K*sigma0*(1-exp(-Ka*C*Vz*t/(K*sigma0));
plot(t,sigma)
end

Running result
Figure 7: Movement number simulation result

Bacteria movement number-Time curve

Coding

function drawBMT(c,b,m0,k)
t=linspace(0,100,101);
M=c*(1-exp(-b*t))*m0.*exp(-k*t);
plot(t,M)
xlabel('Time(s)');
ylabel('Movement bacteria number');
title('PAO1-PLL-0 Movement number-time');
end

Running result
Figure8:Bacteria movement number-Time simulation result

This program is used to predict the advantages of ROSE construction. We successfully demonstrate our ROSE will be able to amplify fluorescence siganl.

Code

clear all
R=R,k=k,k1=k1,k2=k2,k3=k3,k4=k4,k5=k5,k6=k6,k7=k7,k0=k0; %define the constant
t=linspace(0,10); %detecting time range
F=k1*S;
A=k*dsolve('Dx=k2*F','x(0)=0','t');
RA=k3*R*A;
X=k4*RA;
Cl=dsolve('Dx=k5*X','x(0)=0','t');
lambda=1-k6*cl;
t0=fzero(lambda,t); %find the zero point of lambda
if lambda>=0
    G=dsolve('Dx=k7*lambda','x(0)=0','t');
else
    Gm=G(t0);
end
%finish the equation solving step
plot(G,t); %print the G-t picture
hold on
plot(k0*t,t); %print the traditional strategy result in the same image

Demo

Figure 9: ROSE Dynamics simulation result

Contact Us

University of Science and Technology of China, No.96, JinZhai Road Baohe District,Hefei,Anhui, 230026,P.R.China.

Links