Accessible Coding Tools For Your Lab
Intro
I’m not a computer scientist or a data scientist, but that doesn’t mean that I can’t code! All you need is a computer and an AI chatbot to get started. If you’ve been casually learning Python like I have on Dataquest , then you’ll have an even easier time understanding the basics.
We talk about lab automation in this blog, and I want to repeat that lab automation extends beyond the robotics and liquid handling. A fully automated lab integrates software and hardware for seamless workflows. While building out the integrations may need some higher level programming skills, there are other tasks you can use code for to get you started.
In this post, I’ll introduce you to the Python programming language, discuss tools you can use for data analysis and visualization, and talk about pylabrobot, which can use Python to script your lab robots.
What is Python?
Programming is used to:
Give a computer instructions
Automate tasks
Solve problems
Computers have the power to execute higher levels of analysis than is humanly possible. Programming lets you harness those capabilities for faster more reliable results.
A programming language is the language you talk to your computer with to give the instructions. Python is a versatile programming language that has a reputation for being easy to read and write.
If Python is the language you use to talk to your computer, then Python libraries are like specialized dialects. They're collections of pre-written code that provide tools and shortcuts for specific tasks.
We will look at three Python libraries and see what sorts of tasks they’re used for: pandas, matplotlib, and pylabrobot. Two are data analysis tools and one is used to control robotics.
Data analysis on a Dime
The first Python Library I want to talk about is pandas. Here are the main functions:
Data manipulation: pandas allows you to organize, transform, and analyze data
Data analysis: pandas can analyze large datasets all at once and do complex calculations for you
The data you export from instruments if often in csv format. In pandas, you manipulate these DataFrames, which are essentially spreadsheets with rows and columns. You can also run calculations on whole Series, or the columns of the “spreadsheet.”
To visualize the data, you’ll need a different library. matplotlib can visualize data for you for free!
Create plots and charts: various types of graphs, charts, and visualizations are available to present your data.
Customize visualizations: you can customize colors, titles, labels, and legends with your code.
matplotlib can be used with other python libraries to generate EC50 curves and other specialized visualizations seen in biotech. I highly recommend trying these libraries if you’re a small operation that’s tight on funds. Python is a free alternative to proprietary graphing software.
Scripting sans software
I’ve covered a few liquid handling platforms, like the Tecan Fluent. They typically operate with a GUI, or graphical user interface, through their software which can be more user-friendly. GUIs can be advantageous if you are using an all-in-one robot and are only using it’s pre-defined functions.
There is a specialized Python library called pylabrobot, which can be used to script functions on some liquid handlers using Python. Here are some advantages to using Python to script your robots:
Better troubleshooting: Debugging in Python and access to a large community of users makes it easier to refine code.
Flexibility: Scripting in Python can allow more complex behaviors outside the bounds of the vendor software.
Integration: If you’re building a robotic workcell with tools from different vendors, you can use Python to integrate all of the tools and control their actions.
A robot like the Opentrons Flex can be operated with a GUI, but they also encourage writing your own protocols with Python on their website. I’ve talked about the Opentrons robots before, they’re great for smaller companies because of their lower price point.
*DISCLAIMER* Companies like Opentrons encourage open source coding of their robots. That may not be the case for other liquid handlers. Please make sure that operating your liquid handler with Python doesn’t violate the terms of your service agreement with the vendor!
Conclusion
Programming can be a useful tool, and it may be more accessible than you think! With resources like a large user community, detailed documentation, and AI tools, you can get started this afternoon. Learning to code as a scientist is the cheapest way to start automating, and it can save you a lot of time if done correctly.
I hope you got an idea of what programming and Python are, learned about data analysis and visualization tools, and got a taste of how Python can be used to script robots! It’s time to ask yourself, “Why haven’t I incorporated coding into my work?”
I’m going to share my own coding projects with you through this blog every once in a while, so hopefully you’ll be inspired to come on this coding journey with me!