Difference between revisions of "Williams: Optical Trapping Lab 1"

From Course Wiki
Jump to: navigation, search
Line 6: Line 6:
  
 
<h1> Lab 1: Optical Trapping </h1>  
 
<h1> Lab 1: Optical Trapping </h1>  
 
+
---------------------------------------------------------------------
 
<h4> Diagram of Electronic Control System </h4>
 
<h4> Diagram of Electronic Control System </h4>
 
A. To be added later.  
 
A. To be added later.  
 +
 +
---------------------------------------------------
  
 
'''''Instruments/Code'''''<br/>
 
'''''Instruments/Code'''''<br/>
Line 19: Line 21:
  
 
<h4> Goals: What we set out to accomplish </h4>
 
<h4> Goals: What we set out to accomplish </h4>
 +
------------------------------------------------------
 
We set out to add functionality to the trap control software, specifically we wanted to automate centering of the DNA-tethered bead using a centering algorithm which we would write in MATLAB. To center the DNA-tethered bead we would need to learn how to talk to different electronics using DAQ and the daqtoolbox in MATLAB, how to test a code which is supposed to provide specific functionality, and a bit about the gui in MATLAB. After writing the code, our goals expanded to include writing code to simulate a typical optical trap experiment which would be used to measure the persistence length and the contour length of DNA. <br/>
 
We set out to add functionality to the trap control software, specifically we wanted to automate centering of the DNA-tethered bead using a centering algorithm which we would write in MATLAB. To center the DNA-tethered bead we would need to learn how to talk to different electronics using DAQ and the daqtoolbox in MATLAB, how to test a code which is supposed to provide specific functionality, and a bit about the gui in MATLAB. After writing the code, our goals expanded to include writing code to simulate a typical optical trap experiment which would be used to measure the persistence length and the contour length of DNA. <br/>
  
Line 31: Line 34:
  
 
<h4> Project Steps </h4>
 
<h4> Project Steps </h4>
 +
-------------------------------------------------------
 
1. Understanding the OTKB code and figuring out how to use the variables that were already defined in OTKB.m to write our code, for ease of integration.<br/>
 
1. Understanding the OTKB code and figuring out how to use the variables that were already defined in OTKB.m to write our code, for ease of integration.<br/>
 
2. Writing a skeleton for the data acquisition and then the subsequent update of piezoelectric stage position. <br\>
 
2. Writing a skeleton for the data acquisition and then the subsequent update of piezoelectric stage position. <br\>
Line 37: Line 41:
  
 
'''Project Steps''' 1-3<br/>
 
'''Project Steps''' 1-3<br/>
--------
+
 
 
We first started out by creating a function called dnaTetherCentering which fed a sine waveform (only along one axis at a time) into the appropriate PiezoDriver channel. The sine wave was set to complete one full cycle every time the peizoelectric controller was triggered(line 40  of [http://joke021.scripts.mit.edu/DNATetherCentering0302.html dnaTetherCentering.m] ). The next step was figuring out the logical progression of steps for the code. We knew that we wanted to center the DNA-tethered bead in one axis at a time. We eventually settled on first centering the DNA tether in the x axis,centering the DNA tether in the y axis and then going back to the x axis to collect the data that will be used to fit the worm-chain model. These sequence of steps is followed with the use of the variables xcenter and ycenter, as seen in the code. The next step was to design a findCenter. The two main features we used to extract the location of the center of the DNA-tethered bead were the peak and trough of the curve.The peak and troughs of the voltage vs position reading curve correspond to regions where the DNA-tethered bead is "falling" out of the trap.   
 
We first started out by creating a function called dnaTetherCentering which fed a sine waveform (only along one axis at a time) into the appropriate PiezoDriver channel. The sine wave was set to complete one full cycle every time the peizoelectric controller was triggered(line 40  of [http://joke021.scripts.mit.edu/DNATetherCentering0302.html dnaTetherCentering.m] ). The next step was figuring out the logical progression of steps for the code. We knew that we wanted to center the DNA-tethered bead in one axis at a time. We eventually settled on first centering the DNA tether in the x axis,centering the DNA tether in the y axis and then going back to the x axis to collect the data that will be used to fit the worm-chain model. These sequence of steps is followed with the use of the variables xcenter and ycenter, as seen in the code. The next step was to design a findCenter. The two main features we used to extract the location of the center of the DNA-tethered bead were the peak and trough of the curve.The peak and troughs of the voltage vs position reading curve correspond to regions where the DNA-tethered bead is "falling" out of the trap.   
 
Initially we tried to center the DNA-tether by resetting the "center" position of the piezoelectric stage to the same value that corresponded to the DNA-tether-bead's center. This approach had its advantages because it would allow other scanning patterns to be used on the tethered DNA set up. However, we we discouraged against using this technique due to the 'uncertainties' associated with manipulating the piezodrivers.  
 
Initially we tried to center the DNA-tether by resetting the "center" position of the piezoelectric stage to the same value that corresponded to the DNA-tether-bead's center. This approach had its advantages because it would allow other scanning patterns to be used on the tethered DNA set up. However, we we discouraged against using this technique due to the 'uncertainties' associated with manipulating the piezodrivers.  
Line 44: Line 48:
  
  
Psuedo Code  
+
Psuedo Code <br/>
1.set parameters(number of samples to collection,duration of time for collecting samples, trigger to start driving piezoelectric stage, ) for feeding a waveform input DaqInput and retrieving data from DaqOutput
+
1.set parameters(number of samples to collection,duration of time for collecting samples, trigger to start driving piezoelectric stage, ) for feeding a waveform input DaqInput and retrieving data from DaqOutput<br/>
   only wanted to set these parameters once so that they stay the same for the entirety of the centering run  
+
   only wanted to set these parameters once so that they stay the same for the entirety of the centering run <br/>
2. First center the x axis - store the value acquired for the x-axis center
+
2. First center the x axis - store the value acquired for the x-axis center<br/>
3. Center the y axis - store the position acquired for the y axis center
+
3. Center the y axis - store the position acquired for the y axis center<br/>
4. Scan the x-axis and store data for fitting of worm chain model
+
4. Scan the x-axis and store data for fitting of worm chain model<br/>
 +
 
 +
GUI considerations: <br/>
 +
1. Create button that initiates the protocol for centering the DNA-tethered-bead called "Center Sample";<br/>
  
GUI considerations:
 
1. Create button that initiates the protocol for centering the DNA-tethered-bead called "Center Sample";
 
--------
 
  
  
Line 67: Line 71:
 
-------------------------------------------
 
-------------------------------------------
 
<h5> Matlab Code </h5>
 
<h5> Matlab Code </h5>
[http://joke021.scripts.mit.edu/OTKB_AJLMv0301.html Full OTKB code]
+
[http://joke021.scripts.mit.edu/OTKB_AJLMv0301.html Full OTKB code]<br/>
[http://joke021.scripts.mit.edu/DNATetherCentering0302.html DNATetherCentering Function]  
+
[http://joke021.scripts.mit.edu/DNATetherCentering0302.html DNATetherCentering Function] <br/>
[http://joke021.scripts.mit.edu/guifunctions code.html Code for GUI graphics]  
+
[http://joke021.scripts.mit.edu/guifunctions code.html Code for GUI graphics] <br/>
  
 
Architecture of Code:  
 
Architecture of Code:  
 
1. "Oversampling" : 1.5 * NumberOfSamples expected for our SampleRate and signal duration. More samples were taken than  
 
1. "Oversampling" : 1.5 * NumberOfSamples expected for our SampleRate and signal duration. More samples were taken than  
   "needed" that the shape of our signal was fully recorded in the data returned by getdata
+
   "needed" that the shape of our signal was fully recorded in the data returned by getdata <br/>
2. Adjusting sine wave amplitude by voltage values corresponding to centered positions of the tether.  
+
2. Adjusting sine wave amplitude by voltage values corresponding to centered positions of the tether. <br/>
   Explanation  
+
   Explanation <br/>
  
  
  
  
New Additions to Code :  
+
New Additions to Code : <br/>
1. Plotting of the centered values returned by the function  
+
1. Plotting of the centered values returned by the function <br/>
2.  
+
2. <br/>
  
 
<h5> GUI code in DNATetherCentering </h5>
 
<h5> GUI code in DNATetherCentering </h5>
 +
---------------------------------------------------------------
 
Displays graphs of QPD reading and stage position as you center you tether. The data collected while moving the stage in the x axis displays on the lower left graph of the gui and the data collected while moving the stage in the y axis displays on the lower right corner of the gui. <br/>
 
Displays graphs of QPD reading and stage position as you center you tether. The data collected while moving the stage in the x axis displays on the lower left graph of the gui and the data collected while moving the stage in the y axis displays on the lower right corner of the gui. <br/>
 
[[File:OTKB_gui_finding_a_center.png|300px]]
 
[[File:OTKB_gui_finding_a_center.png|300px]]
Line 90: Line 95:
  
 
<h5> Unexpected Bugs/ Problems Encountered <h5/>
 
<h5> Unexpected Bugs/ Problems Encountered <h5/>
<h6
+
------------------------------------------------------------------
 +
<h6> List here
 +
 
 
<h5> Simulation of Code with Stokes Method <h5/>
 
<h5> Simulation of Code with Stokes Method <h5/>
 +
-----------------------------------------------
 
[http://measure.mit.edu/~20.309/wiki/index.php?title=Spring_2012:Leanna_Morinishi_Lab_1 Leanna Morinishi] simulated the results of using the centering function to fit a F vs. x curve passed on parameters calculated using the PSD rolloff calibration method. Below I report on the results one would get if they used our centering function but parameters calculated using the Stokes Method.  
 
[http://measure.mit.edu/~20.309/wiki/index.php?title=Spring_2012:Leanna_Morinishi_Lab_1 Leanna Morinishi] simulated the results of using the centering function to fit a F vs. x curve passed on parameters calculated using the PSD rolloff calibration method. Below I report on the results one would get if they used our centering function but parameters calculated using the Stokes Method.  
  
 +
<h5> Accuracy of DNATetherCentering <h5/>
 +
-------------------------------------------------
  
  
 
<h5> Looking Forward <h5/>
 
<h5> Looking Forward <h5/>
 +
-------------------------------------------------------

Revision as of 07:46, 7 March 2012

20.345: Bioinstrumentation Project Lab


Lab 1: Optical Trapping


Diagram of Electronic Control System

A. To be added later.


Instruments/Code
Matlab : programming language using 'daqtoolbox'
DAQ – National Instruments DAQ Card
Piezoelectric Driver and Controller - TPZ001
Bead size: 0.97 um beads used
Laser wavelength: 976um


Goals: What we set out to accomplish


We set out to add functionality to the trap control software, specifically we wanted to automate centering of the DNA-tethered bead using a centering algorithm which we would write in MATLAB. To center the DNA-tethered bead we would need to learn how to talk to different electronics using DAQ and the daqtoolbox in MATLAB, how to test a code which is supposed to provide specific functionality, and a bit about the gui in MATLAB. After writing the code, our goals expanded to include writing code to simulate a typical optical trap experiment which would be used to measure the persistence length and the contour length of DNA.

Motivating the project goal

We wanted to center the bead so when we fit the x displacement vs. Force applied curve to the worm chain model that the force we calculated(by relating the voltage received from the QPD to the "spring constant" of the laser beam) was being fully applied to the the DNA-tethered bead. By centering the tether, we hoped to improve estimates on the persistence lengths and contour length for the DNA. Furthermore, centering the bead also helped ensured that, to estimate the persistence length and the contour length of the DNA , the only "displacement' of the tether in one direction is being measured. This is necessary because in the worm chain model [See Appleyard] there is a relationship between force and displacement of a linear unit of distance ( x ) of the DNA:

$ F = \frac{k_{B}}{l_{p}}[(\frac{1}{4}(1 - \frac{x}{l_{c}})^{-2} - \frac{1}{4} +\frac{x}{l_{c}}] $

where k_{B} is the Boltzmann constant, l_{c} is the contour length and l_{p} is the persistence length.

Project Steps


1. Understanding the OTKB code and figuring out how to use the variables that were already defined in OTKB.m to write our code, for ease of integration.
2. Writing a skeleton for the data acquisition and then the subsequent update of piezoelectric stage position. <br\> 3. Determining the relationship between the output piezoelectric voltage and the feedback voltage fed into the piezoelectric motor so that the stage can be centered accordingly.
4. Designing a centering algorithm

Project Steps 1-3

We first started out by creating a function called dnaTetherCentering which fed a sine waveform (only along one axis at a time) into the appropriate PiezoDriver channel. The sine wave was set to complete one full cycle every time the peizoelectric controller was triggered(line 40 of dnaTetherCentering.m ). The next step was figuring out the logical progression of steps for the code. We knew that we wanted to center the DNA-tethered bead in one axis at a time. We eventually settled on first centering the DNA tether in the x axis,centering the DNA tether in the y axis and then going back to the x axis to collect the data that will be used to fit the worm-chain model. These sequence of steps is followed with the use of the variables xcenter and ycenter, as seen in the code. The next step was to design a findCenter. The two main features we used to extract the location of the center of the DNA-tethered bead were the peak and trough of the curve.The peak and troughs of the voltage vs position reading curve correspond to regions where the DNA-tethered bead is "falling" out of the trap. Initially we tried to center the DNA-tether by resetting the "center" position of the piezoelectric stage to the same value that corresponded to the DNA-tether-bead's center. This approach had its advantages because it would allow other scanning patterns to be used on the tethered DNA set up. However, we we discouraged against using this technique due to the 'uncertainties' associated with manipulating the piezodrivers. The next approach we tried involved shifting our input voltage signal so that when a input voltage of '0' was feed into one of the axis for the piezodriver, the DNA-tether was centered. This approach mandated that we related the voltage input of our signal to the actual voltage that the piezodriver saw. We assumed this relationship was linear. Using the "getdata" method we were able to obtain the piezodriver voltage reading for a given input voltage signal.


Psuedo Code
1.set parameters(number of samples to collection,duration of time for collecting samples, trigger to start driving piezoelectric stage, ) for feeding a waveform input DaqInput and retrieving data from DaqOutput

 only wanted to set these parameters once so that they stay the same for the entirety of the centering run 

2. First center the x axis - store the value acquired for the x-axis center
3. Center the y axis - store the position acquired for the y axis center
4. Scan the x-axis and store data for fitting of worm chain model

GUI considerations:
1. Create button that initiates the protocol for centering the DNA-tethered-bead called "Center Sample";


Centering curve x axis.jpg


Another algorithm implemented but not fully debugged tried to discern the dna-tether center by calculating the discrete derivative of the voltage signal from the QPD to the uniaxial position movement of the optical trap's stage. The function, essentially looks for a region with discrete derivative (which would correspond to a region were the derivative is zero) <<< 1 and and then find the voltage reading of that "plateau". Then the function checks to see if other features of a good calibration curve are present such as the large (positive and negative) slope leading to the peak on the position/voltage readout curve.


Results of Project Steps


Matlab Code

Full OTKB code
DNATetherCentering Function
code.html Code for GUI graphics

Architecture of Code: 1. "Oversampling" : 1.5 * NumberOfSamples expected for our SampleRate and signal duration. More samples were taken than

  "needed" that the shape of our signal was fully recorded in the data returned by getdata 

2. Adjusting sine wave amplitude by voltage values corresponding to centered positions of the tether.

  Explanation 



New Additions to Code :
1. Plotting of the centered values returned by the function
2.

GUI code in DNATetherCentering

Displays graphs of QPD reading and stage position as you center you tether. The data collected while moving the stage in the x axis displays on the lower left graph of the gui and the data collected while moving the stage in the y axis displays on the lower right corner of the gui.
OTKB gui finding a center.png OTKB gui after Dna Tether Centering.png

Unexpected Bugs/ Problems Encountered <h5/>
List here <h5> Simulation of Code with Stokes Method <h5/>

Leanna Morinishi simulated the results of using the centering function to fit a F vs. x curve passed on parameters calculated using the PSD rolloff calibration method. Below I report on the results one would get if they used our centering function but parameters calculated using the Stokes Method.

<h5> Accuracy of DNATetherCentering <h5/>



<h5> Looking Forward <h5/>