Biowebtronics Biotech, startups, web development and internet of things.

Programming Transcriptic

So you want to program a biology lab? You're in the right place.

Today we are going to instruct a completely automated robotic cloud lab to grab a genetically modified strain of bacteria from a library of common reagents, innoculate some bacterial growth media and finally watch how that culture grows over 8 hours by seeing how the bacteria scatter 600nm light.

Let's get started.

After you sign up for a Transcriptic account you need to install some dependencies, we'll be working with Python today so pip is your friend.

First let's install the Transcriptic CLI tool.

pip install transcriptic

Next we'll be writing Autoprotocol the open standard for experimental specification so we need a tool to help us do that.

pip install autoprotocol

OK we're all set.

Let's run the Transcriptic CLI.

> transcriptic

Usage: transcriptic [OPTIONS] COMMAND [ARGS]...

  A command line tool for working with Transcriptic.

Options:
  --apiroot TEXT
  --config TEXT            Specify a configuration file.
  -o, --organization TEXT
  --help                   Show this message and exit.

Commands:
  analyze         Analyze a block of Autoprotocol JSON.
  build-release   Compress the contents of the current...
  compile         Compile a protocol by passing it a config...
  create-package  Create a new empty protocol package
  create-project  Create a new empty project.
  delete-package  Delete an existing protocol package
  delete-project  Delete an existing project.
  format          Check Autoprotocol format of manifest.json.
  init            Initialize a directory with a manifest.json...
  login           Authenticate to your Transcriptic account.
  packages        List packages in your organization.
  preview         Preview the Autoprotocol output of protocol...
  projects        List the projects in your organization
  protocols       List protocols within your manifest.
  resources       Search catalog of provisionable resources
  submit          Submit your run to the project specified.
  summarize       Summarize Autoprotocol as a list of plain...
  upload-release  Upload a release archive to a package.

First we need to login to our Transcriptic account and specify our organization.

> transcriptic login

Email: example@example.com
Password:
You belong to 3 organizations:
  Sanger Lab (sanger-lab)
  Franklin Lab (franklin_lab)
  Swift on Pharma (swiftpharma)
Which would you like to login as [sanger-lab]? swiftpharma
Logged in as example@example.com (swiftpharma)

Great we're logged in, now we can start writing our protocols. Let's create a file to contain our commands to produce the Autoprotocol description of a growth curve. You could also do this interactively in a Python REPL.

> touch growth_protocol.py
> atom growth_protocol.py

First we'll add the import statements, autporotocol is needed to provide the functions to generate Autoprotocol JSON. And the JSON package is required for some utility methods to handle parsing JSON.

"""
growth_protocol.py

This script produces autoprotocol to execute a growth curve on Transcriptic
"""
from autoprotocol import *
import json

Next let's instantiate a protocol object that all of our instructions are attached to.

p = Protocol()

Now we are going to begin defining the references. References describe containers used in the protocol such as plates and tubes. We are just going to describe 2 containers 1 for the bacteria and one for the plate that will be used in the plate reader to follow along the growth.

A reference takes 5 arguments, name, id, cont_type, storage and discard. id is required if referencing a container that already exists, if instantiating a new container an id will automatically be assigned by Transcriptic upon run submission. cont_type is the type of container, below we are specifying a flat bottomed 96 well plate and a 1.5 mL microcentrifuge tube. storage is the temperature at which you require the sample to be stored when not directly in use. Below the plat will be stored at 4C whenever it is not being used, the tube however will be discarded at the end of the run as discard is set to True.

growth_plate = p.ref("growth_plate", id=None, cont_type="96-flat", storage="cold_4", discard=None)

bacteria = p.ref("bacteria_tube", id=None, cont_type="micro-1.5", storage=None, discard=True)

Now that we have defined our containers we now want to fill them up. First of all we want to get some E. coli from the Transcriptic common reagent library. This can be done with the provision instruction and the resource_id for the material we need. Resource IDs can be found in the catalogue.


dh5a = "rs16pbj944fnny"
p.provision(dh5a, bacteria.well(0), "15:microliter")

Now let's fill the first column of that empty 96 well plate with some growth media. LB-broth should do the job nicely. The code below will dispense 175µL of LB-broth into each well in the first column.

p.dispense(growth_plate, "lb-broth-noAB", [{"column": 0, "volume": "175:microliter"}])

Now let's innoculate 4 of the 8 wells with E .coli using transfer.

test_wells = growth_plate.wells_from(0, 4, columnwise = True)
for dest in test_wells:
  p.transfer(bacteria.well(0), dest, "2:microliter")

In a interactive python session you can see what the test_wells WellGroup looks like. Note that wells are 0 indexed and increment row wise.

>>> test_wells
WellGroup([
  Well(Container(growth_plate), 0, None),
  Well(Container(growth_plate), 12, None),
  Well(Container(growth_plate), 24, None),
  Well(Container(growth_plate), 36, None)
  ])

That's the innoculation taken care of no let's create a loop that will incubate the culture for 30 minutes then take an absorbance measurement at 600nm.

# Set total growth time of growth curve
total_growth_time = Unit(8, "hour")
# Set the number of OD600 measurements taken over the time course.
number_of_measurements = 16

for i in xrange(0, number_of_measurements):
  p.cover(growth_plate) # put a lid on the plate
  p.incubate(growth_plate, "warm_37", duration=total_growth_time/number_of_measurements, shaking=True, co2=0)
  p.uncover(growth_plate) # take lid off of plate
  p.absorbance(growth_plate, measurement_wells, wavelength="600:nanometer", dataref="od600_%s" % i)

Now with all of these in a single python file we need to get some JSON that can be sent to the Transcriptic API.

For this we can use:

# Dump the Autoprotocol JSON.
my_experiment = json.dumps(p.as_dict(), indent=2)
print(my_experiment)

Now from the command line we can run the python file which will print the JSON object to stdout. The stdout can be piped to the Transcriptic CLI.

Let's see how much this protocol run will cost with transcriptic analyze

python growth_protocol.py | transcriptic analyze
✓ Protocol analyzed
  67 instructions
  2 containers
  Total Cost: $25.59
  Workcell Time: $18.25
  Reagents & Consumables: $7.34

Let's find the project we want to submit to:

transcriptic projects

                                   PROJECTS:

              PROJECT NAME              |               PROJECT ID
--------------------------------------------------------------------------------
PCR                                     |             p18qua34567db
--------------------------------------------------------------------------------
Directed Evolution                      |             p18qrn9745vfz
--------------------------------------------------------------------------------
I'll come up with a name later          |             p18s63543jm9t3
--------------------------------------------------------------------------------
Bad Blood... work up                    |             p18qupn345v99
--------------------------------------------------------------------------------
Red... Fluorescent protein cloning      |             p18qrjd345u89
--------------------------------------------------------------------------------
python growth_protocol.py | transcriptic submit -p p18qrjd345u89

Run created: https://secure.transcriptic.com/swiftpharma/p18qrjd345u89/runs/r18sc542345

And that is the run submitted and the robots will execute it.

After the run completes the data can be downloaded from the web app as a CSV or via the API. I will cover data analysis in another post.

If you have any questions head to the forum to further reading check out the Transcriptic support site at developers.transcriptic.com

comments powered by Disqus