Hey hey all,
I wanted to share a cool project I’ve been doing. Using Home Assistant to run a DNA sequencer. Specifically, the Oxford Nanopore MinION. The device is about a $1000 and sequences DNA by drawing it through set of nanopores to “read” it. The devices fits in the palm of your hand, runs on USB3, and the chemistry can be done with only a 37C water-bath.
Unlike other sequencers, this one provides data in real time and is designed for “hackers”. It open-sources the APIs and provides ways to fiddle in both a molecular and software capacity. I’ve been using it to sequence nCoV2 samples (and other stuff).
But it’s UI leaves a lot to be desired and it has no automation capability. Normally you have to wait until the sequencer is done to start your analysis (despite the data being written to the hard-drive in real time). At first, I started figuring out how to do crazy cron-jobs and then I remembered … HOME ASSISTANT.
~10 hours later a UI:
The gauges tell me how fast I’m reading the DNA through the machine. It helps me debug a few failure modes such as clogged pores, depleted “fuel”, and keep track on how quickly my computer is processing the data coming off the machine. This is a “clogged pores” situation.
A deeper look:
When we run our sequencer we often “multiplex” our experiment by running multiple samples at once and then using “barcode sequences” to split them into bins later. Because measuring DNA is hard, sometimes we put unequal amounts of each one, messing up the balance. This data lets me know which ones are failing and lets me correct the problem mid-run. This saves on both time and reagents. Now, runs that took two days for results can be finished in under 5 hours and since some of the consumables are “reusable”, they can be saved for future runs before they are needlessly expended.
Most of the UI was made with a combination of auto-entities and bar-card.
The interface between Home Assistant and the nanopore uses a set of Python scripts that call the minknow_api and dumps the results to a json file. I use the command-line sensor to call the scripts every 5 minutes (or on demand) to request the latest data from the server. This gives information about how much DNA I’ve read, which samples they’re in, where on the genome I’ve measured, and a whole bunch of stats.
Cool automations I’ve got setup:
- The data-processing requires starting a service that holds a big neural-network on my GPU. In the normal system, this is ALWAYS on and taking up valuable processing memory. Now, when HA detects a flowcell is loaded, it auto-loads the data-processing service. When the flowcell is removed, it kills the service gracefully.
- Actionable push notifications for low fuel and depleted pore failures. Actions allow me to pause the run to fix it.
- “Full stack” analysis is done every 30 minutes and I’ve got some metrics that tell me when I’m “done”. A successful “done” return sends a notification (with a graph) and I can confirm and then complete the run.