User:Jonathan Cline/Notebook/Robotics/20091013part2: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
No edit summary
No edit summary
Line 27: Line 27:
===One way (Wrong)===
===One way (Wrong)===
* W3C Recommendations for speech grammars and semantic interpretation
* W3C Recommendations for speech grammars and semantic interpretation
<pre>
<pre><nowiki>
   <rule id="order">
   <rule id="order">
       <tag>var index=0; out.pizza = new Array();</tag>
       <tag>var index=0; out.pizza = new Array();</tag>
Line 44: Line 44:
       <item repeat="0-1"><ruleref uri="#stop"/></item>
       <item repeat="0-1"><ruleref uri="#stop"/></item>
   </rule>
   </rule>
</pre>
</nowiki></pre>
** Much too difficult to edit this
** Much too difficult to edit this
** Much too difficult to read this
** Much too difficult to read this
Line 57: Line 57:
** Computer Scientist response: ''"Oh, but we can simplify that"''
** Computer Scientist response: ''"Oh, but we can simplify that"''


<pre>
<pre><nowiki>
  <emma:interpretation>
  <emma:interpretation>
         <pizza>
         <pizza>
Line 72: Line 72:
         </pizza>
         </pizza>
       </emma:interpretation>
       </emma:interpretation>
</pre>
</pre></nowiki>
** Still Much too difficult to edit this
** Still Much too difficult to edit this
** Still Much too difficult to read this
** Still Much too difficult to read this
Line 90: Line 90:
* YAML Format is Human readable, Human editable and Computer Readable
* YAML Format is Human readable, Human editable and Computer Readable
* YAML allows references to prior definitions and either simple or complex assignments
* YAML allows references to prior definitions and either simple or complex assignments
<pre>
<pre><nowiki>
%YAML 1.1
%YAML 1.1
--- # Fialab-Microsia
--- # Fialab-Microsia
Line 164: Line 164:
                 ok: ~
                 ok: ~
                 err: ~   
                 err: ~   
</pre>
</pre></nowiki>
* Made to be readable and editable
* Made to be readable and editable
* Made to be scalable
* Made to be scalable
Line 183: Line 183:
* YAML Format is Human readable, Human editable and Computer Readable
* YAML Format is Human readable, Human editable and Computer Readable


<pre>
<pre><nowiki>
%YAML 1.1
%YAML 1.1
---
---
Line 208: Line 208:


...
...
</pre>
</pre></nowiki>


</div>
</div>
Line 225: Line 225:
* Perl is '''the #1 bioinformatics language.'''
* Perl is '''the #1 bioinformatics language.'''


<pre>
<pre><nowiki>
sub Main {
sub Main {
     $hw = Robotics::Tecan->new(
     $hw = Robotics::Tecan->new(
Line 263: Line 263:
     checkok $hw->park("liha");
     checkok $hw->park("liha");


</pre>
</pre></nowiki>


</div>
</div>
Line 276: Line 276:
* Advanced error handling for Tecan bio-protocol problems: automatic re-trying
* Advanced error handling for Tecan bio-protocol problems: automatic re-trying


===Medium Term Goal===
Medium Term Goal


* Get something simple working with the software framework.
* Get something simple working with the software framework.
Line 282: Line 282:
*** Far more versatile robotics devices are made every year by undergraduate '''mechatronics''' classes.
*** Far more versatile robotics devices are made every year by undergraduate '''mechatronics''' classes.


===Long Term Goal===
Long Term Goal


* Run a complete bio-protocol ''using the English language''
* Run a complete bio-protocol ''using the English language''
Line 326: Line 326:




<pre>
<pre><nowiki><code>
%YAML 1.1
%YAML 1.1
---
---
Line 388: Line 388:
          
          
         - &bp9 Save the eluted DNA.
         - &bp9 Save the eluted DNA.
</pre>
</code></pre></nowiki>
* Easy to edit (it's text with indenting)
* Easy to edit (it's text with indenting)
* Easy to read (no crazy formatting words)
* Easy to read (no crazy formatting words)

Revision as of 22:30, 10 October 2009


<html> <script> function addStylesheet(url) {

   // presentation mode
   if (document.createStyleSheet) {
       document.createStyleSheet(url);
   }
   else {
       var styles = "@import url('" + url +  "');";
       var newSS=document.createElement('link');
       newSS.rel='stylesheet';
       newSS.href='data:text/css,'+escape(styles);
       document.getElementsByTagName("head")[0].appendChild(newSS);
   }

} if (location.href.indexOf('action=render') > 0) {

   document.write("<head><title>Presentation</title></head>"); // need this for some browsers for addStylesheet to work
   addStylesheet('http://www.w3.org/Talks/Tools/Slidy/slidy.css');
   addStylesheet("/skins/monobook/main.css");
   addStylesheet("/index.php?title=MediaWiki:Common.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000");
   addStylesheet("/index.php?title=MediaWiki:Monobook.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000");
   addStylesheet("/index.php?title=-&action=raw&gen=css&maxage=18000&smaxage=0&ts=20070606210926");
   document.write('<script src="http://www.w3.org/Talks/Tools/Slidy/slidy.js" type="text/javascript"><' + '/script>');
   document.write('<script type="text/javascript">wgBreakFrames = false;<' + '/script>'); // for wikibits.js
   document.write('<script src="/skins/common/wikibits.js" type="text/javascript"><' + '/script>');
   document.write('<script src="/index.php?title=-&action=raw&smaxage=0&gen=js" type="text/javascript"><' + '/script>');

} else {

   // wiki mode
   if (wgServer)
       document.write('<a href="' + wgServer + '/index.php?title=' + wgPageName + '&action=render"><b><em>=> Start web presentation</em></b></a>');

} </script> </html>


jcline@ieee.org - Robotics - Data Format

  • Data formats are very important
    • Make the data usable today
    • Make the data editable today
    • Make the data survive into the future; no obtuse or ridiculously hard to learn format
    • Make the data sharable
  • Computer scientists love inventing data formats
    • Leading to the problem of... too much complexity
  • Vendors love inventing data formats
    • Leading to the problem of... patent / proprietary lockup
  • Open formats are important for innovation and scalability leveraging Long Tail
    • Long Tail means a bunch of work is done today, and numerous incremental improvements occur by many people over decades..
      • vs. single product lifetime of vendor's software and then the data is lost or the data format is unusable

jcline@ieee.org - Robotics - Data Format

One way (Wrong)

  • W3C Recommendations for speech grammars and semantic interpretation
   <rule id="order">
      <tag>var index=0; out.pizza = new Array();</tag>
      <item repeat="0-1"><ruleref uri="#start"/></item>
      <item>
        <ruleref uri="#pizza"/>
        <tag>out.pizza[index]=$pizza; index+=1;</tag>
      </item>
      <item repeat="0-">
         <item><token>and</token></item>
         <item>
           <ruleref uri="#pizza"/>
           <tag>out.pizza[index]=$pizza; index+=1;</tag>
         </item>
      </item>
      <item repeat="0-1"><ruleref uri="#stop"/></item>
   </rule>
    • Much too difficult to edit this
    • Much too difficult to read this
    • Much too difficult to learn this
      • XML, HTML, anything that ugly, is a Bad Idea


jcline@ieee.org Robotics - Data Format

  • W3C Recommendations for speech grammars and semantic interpretation
    • Computer Scientist response: "Oh, but we can simplify that"
<nowiki>
 <emma:interpretation>
         <pizza>
            <number>1</number>
            <size>medium</size>
            <type>pepperoni</type>
         </pizza>
         <pizza>
            <number>1</number>
            <size>large</size>
            <type>cheese</type>
            <topping>sausage</topping>
            <topping>onions</topping>
         </pizza>
      </emma:interpretation>
</nowiki>
    • Still Much too difficult to edit this
    • Still Much too difficult to read this
    • Still Much too difficult to learn this
    • Now needs extra files to describe the custom format
      • Still a Bad Idea


jcline@ieee.org Robotics - Data Format - Device data

  • Each device has data associated with operating it.
  • Storing that data in an easily readable and editable format is very important for software re-use.
  • YAML Format is Human readable, Human editable and Computer Readable
  • YAML allows references to prior definitions and either simple or complex assignments
<nowiki>
%YAML 1.1
--- # Fialab-Microsia
address:
    syringe: A
    valve: C
    peristaltic: D
    external: B
valve:
    send: # delay after cmds 100ms - 1 sec
        NP_SET:
            desc: set number of physical ports
            opcode: NP
            args:
                - 1
                - numport:4-12
            redundancy: 2 # send cmd twice
            delay: 100 # ms
            recv:
                ok: ~
                err: ~
        NP_GET:
            desc: get number of physical ports
            opcode: NP
            args:
                - 0
            redundancy: 2 # send cmd twice
            delay: 100 # ms
            recv:
                ok: ~
                err: ~
peristaltic:
    send: # delay after cmds 100ms - 1 sec
        SET_SPEED:
            desc: set pump speed
            opcode: G
            args:
                - 1
                - speed:0-100
            delay: 100
            recv:
                ok: ~
                err: ~       
        SET_DIRECTION:
            desc: set pump direction, direction:1=counterclockwise or 2=clockwise
            opcode: W
            args:
                - 1
                - direction:1-2:default=1
            delay: 5000
            recv:
                ok: ~
                err: ~        
syringe:
    send: # delay after cmds 100ms - 1 sec
        INIT_ALL:
            desc: init all (both) pumps
            opcode: _Z0R
            args:
                - 0
            delay: 100
            recv:
                ok: ~
                err: ~       
        SET_INPUT:
            desc: position valve in for given pump
            opcode: /$1IR
            args:
                - 1
                - pumpnum:1-2:default=1
            delay: 100
            recv:
                ok: ~
                err: ~  
</nowiki>
  • Made to be readable and editable
  • Made to be scalable
  • Contains all definitions of a device's operation
  • YAML is Best current practice for readable data format


jcline@ieee.org Robotics - Data Format - Environmental data

  • Each device has environment data associated with operating it.
    • Points in space
    • Containers
    • Solids, liquids, gases
  • Storing that data in an easily readable and editable format is very important for software re-use.
  • YAML Format is Human readable, Human editable and Computer Readable
<nowiki>
%YAML 1.1
---
version: 2009-09-04
tecan:
  genesis:
    points:
      roma0:
        magnet-hover: '14056,1850,980,1800'
        magnet-place: '14056,1850,687,1800'
        sampletray-hover: '14057,2828,980,1800'
        sampletray-place: '14057,2828,582,1800'
        shaker-hover: '1780,3569,1535,1800'
        shaker-put: '1780,3569,865,1800'
        shaker-take: '1780,3569,865,1800'
        shakerlock-1: '1762,1177,1535,900'
        shakerlock-2: '1762,1177,815,900'
        shakerlock-3: '1191,1177,808,900'
        shakerlock-4: '1762,1177,815,900'
        shakerlock-5: '1762,1177,1535,900'
        shakerlock-6: '1780,3569,1535,1800'
        shakerlock-hover: '1780,3569,1535,1800'
        HOME1: '11165,2525,980,1800'

...
</nowiki>

jcline@ieee.org Robotics - What's Running Now

  • General purpose software to control FIAlab syringe pump and 10-way valve
  • General purpose software to control part of the Tecan arm
  • Network operation of the Tecan; run a bio-protocol from your desk
    • Get the current operational status in real time
  • That's not much, yet
  • 2 releases already made to the public internet software archive for Perl (CPAN)

The end user writes a simple Perl application to control all devices and robotics.

  • Perl is the #1 bioinformatics language.
<nowiki>
sub Main {
    $hw = Robotics::Tecan->new(
        connection => 'network,Robotics::Tecan::Genesis,genesis0',
        token => 'M1',
        serveraddr => 'heavybio.dyndns.org:8088',
        password => $ENV{'TECANPASSWORD'});

    $hw->attach("o");
    $_ = $hw->status();
    exit -2 if !/IDLE/i;

    # Load worktable
    $hw->configure("client-traymove1test.yaml");   

    my @path = (
        "shakerlock-hover", 
        "shakerlock-1",
        "shakerlock-2",
        "shakerlock-3",
        "shakerlock-4",
        "shakerlock-5",
        "shakerlock-hover"
        );
    checkok $hw->move_path("roma0", @path);

    checkok $hw->move("roma0", "shaker-take");
    checkok $hw->grip("roma0");
    checkok $hw->move("roma0", "shaker-hover");

    checkok $hw->move("roma0", "sampletray-hover");
    checkok $hw->move("roma0", "sampletray-place");
    checkok $hw->grip("roma0", 'o', 120);
    checkok $hw->move("roma0", "sampletray-hover");
    checkok $hw->park("roma0");

    checkok $hw->park("liha");

</nowiki>

jcline@ieee.org Robotics - What's Running in "Upcoming Weeks"

  • General purpose software to control FIAlab
  • General purpose software to control Tecan arm & Tecan liquid handler & Tecan peripherals
  • Network operation of all of the above; run a bio-protocol entire flow from your desk
    • And get the data results back from MATLAB in real time
  • Advanced error handling for Tecan bio-protocol problems: automatic re-trying

Medium Term Goal

  • Get something simple working with the software framework.
    • Swap out the existing devices for smarter ones.
      • Far more versatile robotics devices are made every year by undergraduate mechatronics classes.

Long Term Goal

  • Run a complete bio-protocol using the English language
    • Meaning, bio-latin-english


jcline@ieee.org Robotics - Long List of Benefits

  • Allows many devices to be controlled from the same user program
  • Allows device operations not supported by the vendor
    • This includes much better error handling & re-trying
  • Allows abstraction of the devices: swap out one device for another
    • Removes vendor lock-in, creating more competitive forces to drive innovation among various devices
  • Plug in new custom devices, can quickly operate with same user program
  • Network operation
    • The controller PC will miss fewer commands since vendor application does not take CPU time
    • The user PC doesn't have to be Windows to run a device (many benefits there)
    • The user can access device status and device output from anywhere (lab or home)
  • The user can program complex algorithms using multiple devices, creating a control system with feedback to optimize a protocol or make arbitrary decisions
    • The "Robot Scientist" was claimed to have identified new targets "on it's own" - using data feedback and prediction

jcline@ieee.org Robotics - Protolexer

Let's Do Something "Simple" : Revisited

  • Feed the protocol directly to the computer.
  • Computers are smart enough.
  • The computer knows what devices are attached or available on the network.
  • Integrate the devices together into a long chain.
  • Bio-protocols have fairly standardized formats and standardized language.
    • Or can be, with human editing of the English, and a human quickly verifying the "compiled" result before robotics operation.

http://biosx.com/88proof/synthetic_biology/blog/wp-content/uploads/2009/06/protolexer1.png


jcline@ieee.org Robotics - Data Format - Bio-protocols

<nowiki><code>
%YAML 1.1
---
protocol: Mate-Paired Library Preparation for Sequencing
methods:
 - &standard-purify purify with column:
        - &cp1 Add 3 volumes of Buffer QG and 1 volume of isopropyl alcohol to the sheared
          DNA. If the color of the mixture is orange or violet, add 10uL of 3M sodium
          acetate, pH5.5 and mix. The color turns yellow. The pH required for efficient
          adsorption of the DNA to the membrane is <= 7.5. 
        
        - &cp2 Apply 750uL of sheared DNA in Buffer QG to the column(s). The maximum
          amount of DNA that can be applied to a QIAquick column is 10ug. Use more 
          columns if necessary. 
          
        - &cp3 Let the column(s) stand for 2 minutes at room temperature. 
        
        - &cp4 Centrifuge the column(s) at >= 10,000g (13,000 rpm) for 1 minute, then discard 
          the flow-through. 
          
        - &cp5 Repeat steps 2 and 4 until the entire sample has been loaded onto the column(s). 
          Place the QIAquick column(s) back into the same collection tube(s). 
          
        - &cp6 Add 750uL of Buffer PE to wash the column(s). 
        
        - &cp7 Centrifuge the column(s) at >= 10,000g (13,000 rpm) for 2 minutes, then discard 
          the flow-through. Repeat to remove residual wash buffer. 
          
        - &cp8 Air-dry the column(s) for 2 minutes to evaporate any residual alcohol. Transfer 
          the column(s) to clean 1.5-mL LoBind tube(s). 
          
        - &cp9 Add 30uL of Buffer EB to the column(s) to elute the DNA and let the column(s) 
          stand for 2minutes. 
          
        - &cp10 Centrifuge the column(s) at >= 10,000g (13,000 rpm) for 1 minute. 
        
        - &cp11 Repeat steps 9 and 10. 
        
        - &cp12 If necessary, pool the eluted DNA. 
        
 - &bead-purify purify with magbeads:
        - &bp1 Add 100uL of DNA to 95uL of magbeads.
        
        - &bp2 Vortex at 1,000RPM for 1 minute.
        
        - &bp3 Incubate on magnets for 300 seconds at room temperature to allow DNA to 
              bind to beads and beads to settle.
        
        - &bp4 Remove supernatant while beads are magnetized.
        
        - &bp5 Elute while beads are magnetized using 100uL of EtOH.  
              Pause for 90 seconds during each wash to allow beads to settle.  
              Allow EtOH to evaporate until beads are dry and 
              cracks are visible in the bead surface.
        
        - &bp6 Resuspend with 15 uL Buffer xx to resuspend beads.
        
        - &bp7 Vortex at 1,000RPM for 20 seconds.
        
        - &bp8 Incubate for 200 seconds on magnets at room temperature.
        
        - &bp9 Save the eluted DNA.
</code>
</nowiki>
  • Easy to edit (it's text with indenting)
  • Easy to read (no crazy formatting words)
  • Very easy to share
    • Standardized format
    • Self-contained, no extra files needed
  • Mostly easy to learn
  • Easy for computers to read, process, write, share
  • Defined in YAML



jcline@ieee.org Robotics - Competing Method: BioStream (MIT)

  • "Towards a High-Level Programming Language for Standardizing and Automating Biology Protocols"
    • "Abstraction Layers for Scalable Micro¿uidic Biocomputers", William Thies1 , John Paul Urbanski2 , Todd Thorsen2 , and Saman Amarasinghe, Computer Science and Arti¿cial Intelligence Laboratory, Hatsopoulos Micro¿uids Laboratory, Massachusetts Institute of Technology, {thies, urbanski, thorsen, saman}@mit.edu
    • Defines "high level" (like Java/C++) language for describing protocols
    • Can take some standardized English protocols as input
    • Can automatically generate the "high level language" for the computer
    • Can output a human-readable clean English bio-protocol
      • This is a "Validated-clean" version of original bio-protocol

BioStream "clean English output" for DNA extraction from tissue protocol

http://88proof.com/biotech/img/Biostream-DNA%20extraction%20from%20tissue%20protocol-English-Output.png

jcline@ieee.org Robotics - Competing Method: BioStream (MIT)

  • "Towards a High-Level Programming Language for Standardizing and Automating Biology Protocols"

BioStream "high level language" for DNA extraction from tissue protocol

http://88proof.com/biotech/img/Biostream-DNA%20extraction%20from%20tissue%20protocol-Source-Output.png