Python For Handling 96-Well Plate Data and Automation

book-graphics.005There’s hardly a life science lab you can walk into these days, without seeing a ton of 96-well plates and instruments that read and handle them. That’s why we’ve dedicated an entire chapter of our forthcoming book Python For The Life Sciences, to the humble 96-well plate.

The chapter introduces the use of Python for handling laboratory assay plates of many different sizes and configurations. It shows the reader how to read plate assay data from files formatted as comma-separated values (CSV), how to implement basic row and column computations, how to plot multi-well plates with the wells color-coded by their properties, and even how to implement the high level code necessary for driving instruments and robots through devices like Arduinos.

And this is just one of about 20 chapters designed to introduce the life scientist who wants to learn how to code, to the wonderful and versatile Python programming language.

Almost all of the code and examples in the book are biology-based and in addition to teaching the Python programming language, the book aims to inspire the life scientist reader to bring the power of computation to his or her research, by demonstrating the application of Python using real-world examples from across a wide range of biological research disciplines.

The book includes code and examples covering next-generation sequencing, molecular modeling, biomarkers, systems biology, chemical kinetics, population dynamics, evolution and much more.

Python For The Life Sciences should be available as an eBook this fall (2016), so if you’re a life scientist interested in bringing a computational skill set to your research and your career, visit the book’s web page and sign up to our (no spam) mailing list for updates about the book’s progress and publication.

© The Digital Biologist

A Cartoon History Of The Theranos Scandal

KQED_Theranos_01Here at The Digital Biologist, we have reported at some length on the Theranos scandal, since it serves as an example of the way that biological data can be used (and misused) in the development of new healthcare technologies.

Now the KQED Science web site has published a wonderful cartoon history of the rise and fall of Theranos, along with links to the major articles that described this history as it was unfolding. It’s a kind of an everything-you-ever-wanted-to-know-about-the-Theranos-scandal-but-were-afraid-to-ask, all presented on a single page. Enjoy 🙂

© Digital Biologist

The Future of Research is now a thing

FOR-250To be fair, it always was a ‘thing’, but now that The Future of Research has made it official by becoming a fully-fledged non-profit organization, it’s now really a ‘Thing’ (with a big T). This is no small feat for a group that started out as a loosely-knit assembly of grassroots activists who share a common interest in improving things for academic researchers. In only three years, they have built both national  and international recognition for their movement. They were named 2015 People of the Year by Science Careers, as well as landing a 2-year, $300,000 grant from the Open Philanthropy Project, to help them in their work in assisting junior scientists in grassroots efforts to change science policy.

So congratulations to the Future of Research on becoming a Thing with a big T. Anyone who cares about the future of academic research and the working conditions and job prospects of those who pursue careers in it, should consider joining this very important conversation that the Future of Research has started.

As history has taught us over and over, systems that are broken, dysfunctional and unfair, rarely if ever transform or dismantle themselves from the top down, but rather, from the bottom up. Those who benefit the most from such systems are also usually its gatekeepers, and they will generally strive (consciously or unconsciously) to preserve it since they potentially have the most to lose from changing it. This is precisely why grassroots organizations like The Future of Research are so important as instruments of social change.

© The Digital Biologist

Big Data Does Not Equal Big Knowledge

Raf-Mek-Erk-IM-bordered.001

… the life science Big Data scene is largely Big Hype. This is not because the the data itself is not valuable, but rather because its real value is almost invariably buried under mountains of well-meaning but fruitless data analytics and data visualization. The fancy data dashboards that big pharmaceutical companies spend big bucks on for handling their big data, are for the most part, little more than eye candy whose colorful renderings convey an illusion of progress without the reality of it.

Read the full article on LinkedIn.

© The Digital Biologist

Python For The Life Sciences: Table of contents now available

Coming Soon ...Our book Python For The Life Sciences is now nearing publication – we anticipate sometime in the early summer of 2016 for the publication date. Quite a number of people have asked us to release a table of contents for the book, so without further ado, here is the first draft of the table of contents.

If you would like to receive updates about the book, please sign up for our book mailing list.

Python at the bench:
In which we introduce some Python fundamentals and show you how to ditch those calculators and spreadsheets and let Python relieve the drudgery of basic lab calculations (freeing up more valuable time to drink coffee and play Minecraft)

Building biological sequences:
In which we introduce basic Python string and character handling and demonstrate Python’s innate awesomeness for handling nucleic acid and protein sequences.

Of biomarkers and Bayes:
In which we discuss Bayes’ Theorem and implement it in Python, illustrating in the process why even your doctor might not always estimate your risk of cancer correctly.

Reading, parsing and handling biological sequence data files:
Did we already mention how great Python is for handling biological sequence data? In this chapter we expand our discussion to sequence file formats like FASTA.

Regular expressions for genomics:
In which we show how to search even the largest of biological sequences quickly and efficiently using Python Regular Expressions – and in the process, blow the lid off the myth that Python has to be slow because it is an interpreted language.

Biological sequences as Python objects:
Just when you thought you had heard the last about sequences, we explore the foundational concept of Object Oriented Programming in Python, and demonstrate a more advanced and robust approach to handling biological sequences using Python objects.

Slicing and dicing genomic data:
In which we demonstrate how easy it is to use Python to create a simple next-generation sequencing pipeline – and how it can be used to extract data from many kinds of genomic sources, up to and including whole genomes.

Managing plate assay data:
In which we use Python to manage data from that trusty workhorse of biological assays, the 96-well plate.

Python for structural biology and molecular modeling:
In which we demonstrate Python’s ability to implement three-dimensional mathematics and linear algebra for molecular mechanics. It’s nano but it’s still biology folks!

Modeling biochemical kinetics:
In which we use Python to recreate what happens in the biochemist’s beaker (minus the nasty smells) – as well as using Python to model the cooperative binding effects of allosteric proteins.

Systems biology data mining:
In which we demonstrate how to parse and interrogate network data using Python sets, and in the process, tame the complex network “hairball”.

Modeling cellular systems:
In which we introduce the Gillespie algorithm to model biological noise and switches in cells, and use Python to implement it and visualize the results – along with some pretty pictures to delight the eye.

Modeling development with cellular automata:
In which we use the power of cellular automata to grow some dandy leopard skin pants using Turing’s model of morphogenesis with Python 2D graphics. Note to our readers: no leopards were harmed in the writing of this chapter.

Modeling development with artificial life:
In which we introduce Lindemeyer systems to grow virtual plants and use Python’s implementation of Turtle LOGO. Don’t worry, these plants will not invade your garden (but they might take over your computer).

Predator-prey dynamics in ecology:
In which we let loose chickens and foxes into an ecosystem and let ‘em duke it out in a state-space that is visualized using Python’s animation features.

Modeling virus population dynamics with agent-based simulation:
In which we create a virtual zombie apocalypse with agents that have internal state and behaviors. These are definitely smarter-than-usual zombies that illustrate an approach in which Python’s object-oriented programming approach really shines.

Modeling evolution:
In which we use the Wright-Fisher model to demonstrate natural selection in action, and show how being the “fittest” doesn’t always mean that you will “win”. Think Homer Simpson winning a game of musical chairs.

© The Digital Biologist

Theranos: A unicorn with real potential or a horse in a costume?

Theranos, the troubled healthcare startup (it feels faintly ridiculous to use that term for a company valued at $9 billion),  is now at something of a crossroads with the regulatory agencies upon whose approval its entire business model ultimately depends. Following months of apparent obfuscation and stonewalling about how (and how well) its disruptive blood testing technology works,  a scathing Wall Street Journal article exposed a degree of potential fraud and deceit surrounding this much lauded technology, that nobody outside Theranos could have imagined (especially since most of the lauding was coming from the company’s own PR machine).

Despite the clamor for Theranos to release for peer review, some of the findings and data it has generated in the course of developing its blood-testing technology that it claims can replace the use of hypodermic needles with a simple finger prick, the technology is still largely a black box to outsiders. Investors and industry observers want to know if the technology’s potential squares with the company’s stratospheric valuation, but more importantly – regulatory agencies, healthcare providers and their patients need to know if the medical diagnostic tests that use this technology, actually work and are accurate and reliable.

There’s a great deal more than money at stake here.

This week’s regulatory call for Theranos could literally make or break the company depending upon which way it goes. Failure to be in regulatory compliance could bring with it, a host of new problems for the struggling company including crippling fines and the inability to operate until such time as it can demonstrate that it has addressed the problems raised by the regulatory agencies. Most damaging of all however, this would be yet another huge blow to its already strained credibility with investors and healthcare provider partners, some of whom have already withdrawn or suspended their relationships with Theranos over doubts about the efficacy and accuracy of its blood tests. Beyond the problems that this could create for Theranos itself, many industry observers fear the effects that it could have on the entire sector if a contagion of doubt and panic were to grip investors and financiers, potentially stemming the flow of biotechnology venture funding and capital.

© The Digital Biologist

A sample chapter from our forthcoming book “Python For The Life Sciences”

chapter-comicsIn conjunction with my business partner Alex Lancaster, we are very excited for this early release of a sample chapter from our forthcoming book Python For The Life Sciences. This book is written primarily for life scientists with little or no experience writing computer code, who would like to develop enough programming knowledge to be able to create software and algorithms that they can use to advance or accelerate their own research. These are probably scientists who are currently using spreadsheets and calculators to handle their data, but who have probably promised themselves that at some point when the opportunity arises, they will learn to write code. If this pretty well describes your situation, then your wait is over and the opportunity is knocking. This could very well be just the book you have been waiting for!

In short, this is the book that would like to have read when we were learning computational biology.

The aim of this book

The aim of this book is to teach the working biologist enough Python that he or she can get started using this incredibly versatile programming language in their own research, whether in academia or in industry. It also aims to furnish a Python foundation upon which the biologist can build by extrapolating from the broad set of Python fundamentals that the book provides.

What this book is not

This book is not another comprehensive guide to the Python programming language, nor is it intended to be a Python language reference. There are already plenty of those out there, and easily accessible online. For this reason, you will find that there are many (many) aspects and areas of the Python language that are not covered. In a similar vein, this book is not intended to be a life science primer for programmers and computer scientists.

A tour of computational biology beyond bioinformatics

This book is all about using computational tools to jumpstart your biological imaginations. We will show the reader the range of quantitative biology questions that can be addressed using just one language from a range of life sciences. The examples are deliberately eclectic and cover bioinformatics, structural biology, systems biology to modeling cellular dynamics, ecology, evolution and artificial life.

Like a good tour, these biological examples were deliberately chosen to be simple enough not to impede the reader’s ability to assimilate the Python coding principles being presented – but at the same time each scientific problem illustrates a simple, yet powerful principle or idea. By covering a wide variety of examples from different parts of biology, we also hope that the reader can identify common features between different kinds of models and data and encounter unfamiliar, yet useful ideas and approaches. We provide pointers and references to other code, software, books and papers where they can explore each area in greater depth.

We believe that exploring biological data and biological systems should be fun! We want to take you from the nuts-and-bolts of writing Python code, to the cutting edge as quickly as possible, so that you can get up and running quickly on your own creative scientific projects.

The sample chapter shows how to use Python to mine and understand data from transcription factor networks and you can get it here.

© The Digital Biologist

Are you still using calculators and spreadsheets for research projects that would be much better tackled with computer code?

Coming Soon ...With my co-author Alex Lancaster, I am in the latter stages of writing a book “Python for the Life Sciences” which will be an accessible introduction to Python programming for biologists with no prior experience in coding, who would like to be able to bring a computational approach to their own research. In the book, we are trying to cover a broad enough array of biological application areas for the book to be a valuable guide and inspiration to life scientists in fields as diverse as NGS, Systems Biology, Genomics, Protein Engineering, Evolutionary Biology and so on.

It has been our experience that there are a lot of researchers working in diverse areas of biology currently using calculators and spreadsheets for their work, but who would be able to do a great deal more using a versatile scripting and programming language like Python.

If you are one of these people, we would really love to hear from you.

What are the life science research problems that you would tackle computationally, if you were able to use code?

You can reply to this request either directly in the comments (where your response will be publicly visible), or if you prefer to do so privately, offline via info@amberbiology.com

If your area of interest is something we have not covered in the chapters we have written already and we think it could be sufficiently interesting to the life science research community, we will endeavor to include it in the book, and also in the Python training sessions that we will be doing for researchers following the book’s release.

Many Thanks to all who take the time to respond.

© The Digital Biologist

The Central Role Of User Experience Design In Scientific Modeling

Big-Simulation-BorderedData is not knowledge.

Data can reveal relationships between events – correlations that may or  may not be causal in nature; but by itself, data explains nothing without some form of conceptual model with which it can be assimilated into an intellectual framework that allows one to reason about it.

Computational modeling is not in the mainstream of life science research in the way that it is in other fields such as physics and engineering. And while all scientific concepts are implicitly models, most biologists have had relatively little experience of the kind of explicit modeling that we’re talking about here. In fields like biology where exposure to computational models is more limited, there is a tendency to consider their utility largely in terms of their ability to make predictions – but what often gets overlooked is the fact that models also facilitate the communication and discussion of concepts by serving as cognitive frameworks for understanding them.

Next to the challenge of representing the sheer complexity of biological systems, this cognitive element of modeling may be the single biggest reason why modeling is not in the mainstream of the life sciences. Most biological models use idioms borrowed from other fields such as physics, where modeling is both more mature, and firmly in the mainstream of research.

For a model to be truly useful and meaningful in a particular field of intellectual activity, it needs to support the conceptual idioms by which ideas and knowledge are shared by those in the field.

In other words, it should be possible to put questions to the model that are couched in the conceptual idiom of the field, and to receive similarly structured answers. To the extent that this is not true of a model, there will be some degree of cognitive disconnect between the model and the user which will impede the meaningful interaction of the user with the model.

Nowhere can this be more clearly seen than in the field of software design. Software applications make extensive use of cognitive models in order to facilitate a meaningful and intuitive interaction with the user. As a very simple example – software that plays digital music reproduces the play, forward and reverse buttons that were common on physical media devices like cassette and VHS players. This is because almost everybody has the same expectations about how these interface components are to be used, based upon their prior experience with these devices. As an aside, it’s interesting to reflect on the fact that while the younger generation may see these interaction motifs everywhere in the user interfaces of software media players, many of them will never have seen the original devices whose mechanical interfaces inspired their design.

blog-graphics-2015.001

The psychology and design that determines these interactions with the objects and devices that we use, is such an important area of study that it has given rise to an entire field that is commonly referred to as User Experience (UX) or User Experience Design. UX lies at the intersection of psychology, design and engineering and is concerned with the way that humans interact with everything in the physical world from a sliding door to the instrument panel of an airliner – and of course, their analogs in the virtual world; web browsers, electronic books, photo editing software, online shopping carts and so on.

Affordances and signifiers are the currency of UX design, facilitating the interaction between the user and the object or software. If you consider an affordance as a means of interaction (like the handle on a door for example), signifiers are signs for the user that suggest how the affordances might work. To use our very simple door handle example – a handle that consists of a flat metal plate  on the door suggests that the door be pushed open. A handle consisting of a metal loop more strongly suggests that the door should be pulled open. For the purposes of illustration, this is just a very superficial and simple example of the kind of cognitive facilitation that effective UX design can support. By contrast, consider the role that UX design plays in highly complex, human-built systems whose interactions with the user are predicated on multiple and often interdependent conceptual models, each of enormous complexity in its own right. In some cases, a single, erroneous interaction with such a system might even destroy the system and/or lead to the loss of human life.

So what does all of this have to do with scientific modeling?

By facilitating a cognitive connection between the user and an object, a device or a piece of software, effective UX design makes the interaction easier, more intuitive and more meaningful. Insofar as a computational model is being used to develop a conceptual framework that explains data, effective UX design similarly facilitates the cognitive leap from data to knowledge.

Perhaps the best way to appreciate this is to see it in action, and if you’ll bear with me, I would like to illustrate this with an example from my own experience.

As VP of Biology at a venture-funded software startup building a collaborative, cloud-computing platform to model complex biological pathways, a major part of my role in the company was to serve as the product manager for the software. In practice, this actually comprised two roles. The first was an internal role as the interface between the company’s biology team tasked with developing the applications for our product, and our software engineering team who were tasked with building the product. The second was an external-facing role as a product evangelist and the liaison between our company and the life science research community – the potential client base for whom we were building our product.

One component of our cloud-computing platform was an agent-based simulation module for modeling cell signaling pathways. The ‘players’ in these simulations were as you would expect, mostly proteins involved in cell signaling pathways – kinases, phosphatases etc. and any kind of phosphoprotein whose cellular activity is typically modulated by the kind of post-translational modification events that proteins like kinases and phosphatases mediate.

As a simulation proceeded on the cloud, it could be tracked by the user through a range of different visualizations in their web browser. One of these displayed the concentrations of the different molecular species present in the simulation, over time. This was initially presented as a graph like this:

Big-Simulation-Bordered-graph-crop

But if you think about the way that a biologist in the laboratory would do this experiment, this presentation of the results, while being information-rich, would not be what he or she was used to. The analogous lab experiment would probably involve sampling the reaction mixture at regular intervals and for example, running these aliquots as a time series on a gel to visualize their fluctuations over the course of the experiment.

My initial proposal that we add a visual element to the graph that reproduced what the biologist would see if they were to run the reaction mixture from a particular time point on a gel, was met with some degree of skepticism from the software engineers .

To be fair, it has to be said at this point that any good software engineering team (consisting of developers, business analysts, product managers etc.) always will (and should) set a high bar for the approval of new features in the code, especially where there is any kind of significant cost in time, money or resources required for their implementation. We were fortunate in our company, to have just such an excellent software engineering team and so their initial resistance to this idea was not wholly unexpected. The main argument against it was that it would not be an information-rich visual presentation of the simulation results in the way that the graph already was, and furthermore, that it was redundant since this information was already presented at a much higher resolution in the graph.

When however, in my capacity as external liaison with our potential client base,  I tested the response of the life science research community to a mock-up of this feature, the results were amazingly positive.

Big-Simulation-crop

We asked biologists who agreed to be interviewed, to compare the version of the simulation interface that contained only the graph, with a mock-up of an updated version (shown above), that also contained a simulated Western blot display with a time slider that could be moved across the graph to show what the Western blot gel would look like at each sampled time point.

Their responses were striking. What we heard most often from them (and I’m aggregating and paraphrasing the majority response here), was that the version of the interface with the Western blot display made a great deal more sense to them because it helped them to make the mental leap between the data being output from the model and what the model was actually telling them. In their minds and perhaps most importantly, it also reinforced the idea of the computational simulation as a virtual experiment whose results could help guide their decisions about which physical experiments to do in the lab.

Despite this new visualization not being information-rich as the software engineers had rightly pointed out – in its ability to frame the output from the simulation model in an idiom that was meaningful to the biologist,  it created a richer and deeper cognitive connection between the biologist-modeler and the biology that was being represented and explored in the model.

Recognizing that if modeling is ever to really become a part of the mainstream in life science research in the way that it is in physics, we took very seriously, the idea of doing biological modeling in an idiom that is appropriate for biology. This idea permeated every aspect of the development of our collaborative computational modeling platform, especially since it was also clear from our own product and market research, that biologists were no more willing to become mathematicians or computer scientists to use models in their own research, than people were willing to become mechanics in order to drive cars.

Signaling-CartoonTake a look for example, at this cartoon a biologist drew of a cell signaling pathway (thanks Russ). It illustrates perfectly the paradigm of an interconnected network of signaling proteins that is in essence, the consensus model in the biology community for how cell signaling works. At some level, it matters little that we cannot consider this to be a realistic, physical model of cell signaling since it implies the existence of static ‘biological circuits’ that in reality do not exist in the cell. In using this model however, biologists are not suggesting this at all. This model does a very good job of representing conceptually, the network of interactions that determine the functional properties of a cell signaling pathway.

There are some obvious intuitive benefits to this model (and many more very subtle ones). For example, if we were to try to trace the network edges from one protein (node) to another and discovered that they were not connected by any of the other proteins, we could infer that none of the states available to the first protein, could ever have an influence on the states of the second.

Raf-Mek-Erk-CMHere for comparison, is the analogous representation of that same cell signaling pathway, assembled on our cloud computing platform using a set of lexical rules that describe each of the ‘players’ and their interactions. Even the underlying semantic formalism that we used as as a kind of biological assembly language to represent the players (usually proteins) and their interactions, was couched in terms of a familiar and relatively small set of biological events (binding, unbinding, modification etc.) that are in themselves, sufficient to represent almost everything that happens in a cell at the level of its signaling pathways.

In summary then, insofar as computational models facilitate thinking and reasoning about the biological systems we study and collect data from, they can help us much more effectively if they allow us to work in the idioms that are familiar and appropriate to our field. This notion can be more fully grasped by considering its antithesis – the use of ordinary differential equations (ODEs) to model biological systems, which still tends to be the dominant paradigm for biological modeling despite being an exceedingly opaque, unintuitive and largely incompatible approach for modeling systems at a biological scale.

It is also clear that software developers need to work closely with experts who have specialized domain knowledge if they are to create computational modeling platforms that will not only be effective for their particular domain, but also widely adopted by its practitioners. In the case of biology, it was clear to us when we were developing our modeling platform, that its success would depend in no small part, on the appeal that it could make to the imagination and intuition of the biologist. With computational modeling as with software development, even the most meticulously crafted of tools will have little or no impact or utility in its field if a cognitively dissonant user experience results in it rarely or never being used.

© The Digital Biologist