Running a DNA Sequencer with Home Assistant

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.
6 Likes

this is awesome. All i can do is turn lights on and off depending on sunset.

I was hearing about this a few hours ago when I was listening to the HA podcast.
It is a nice setup, but could be made so much better with some canvas gauges. In all seriousness, you can use the picture-elements card with a canvas-gauge on top of it. The picture is the extended background of the gauge and can have more useful information; such as in your case (example) if 500 RPM it indicates blank process.

Some examples that I use:

You could to the same for the sensor gauges you are using also, I just have a preference to the canvas gauges. I got the idea from the UV tread here and expanded on it.
https://community.home-assistant.io/t/cool-uv-index-gauge-for-my-swimming-pool-area/116223
@Ali_Kiaie gets the credit (blame) for my canvas gauge background obsession.

It is interesting to see the different cases that people use HA for.

1 Like

That is really cool! I spent some time adjusting the severity options in either the default lovelace cards or the bar-cards. But yours look SOO much cooler and gives a better idea when you’re on the edge of a semi-arbitrary cutoff.

I’ll play around and see what I come up with. Thanks for the tip.

This should save you some time:
https://github.com/GlennGoddard/CanvasGaugeBackgrounds

If you need help let me know.

1 Like

This is awesome! As a former molecular biologist, I’m heartened to see the spirit of innovation and open science is alive: not everything has been captured by just-spend-more-money for shiny (proprietary) machines. Hope you get lots of good data!