Seeing nucleotides as images

Wait 5 sec.

[This article was first published on Data Science Guts, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. In 2022 I spent a few months on a problem far from anything I had done before: finding single letters in the tails of RNA molecules, from the electric current of a nanopore sequencer. The network I built then is the classifier inside Ninetails, an R package from Natalia Gumińska and her colleagues at the IIMCB in Warsaw. The paper describing it came out in 2025 (Gumińska et al., Nature Communications).I am not a geneticist, and this post does not pretend otherwise. What hooked me was the computer vision: the signal is a time series, the trick that made it work was to turn it into images, and that trick is worth knowing well beyond biology.This is the first post of a short series. Here: just enough biology to follow along, what the images are, and the whole pipeline again – from public raw data to a trained network – to check that the 2022 result holds up.The biology, brieflyA gene’s instructions travel from DNA to the protein-making machinery of a cell as messenger RNA (mRNA): a chain of four kinds of nucleotides, written A, C, G and U. Most mRNAs end in a poly(A) tail – tens to a couple of hundred As in a row. The tail is not part of the message; it is closer to a fuse. It protects the molecule and influences how long it lives and how much protein is made from it.The tail is not always pure A. It can also contain nucleotides other than adenosine – for example C, G or U, slipped in by the enzymes that build and rebuild it – and these non-adenosines are linked to how long an mRNA survives. That makes them interesting far beyond basic research: the Ninetails paper follows, among others, the tails of the Moderna mRNA-1273 vaccine after it enters immune cells.To count them, one needs to read the tail itself, letter by letter. That is where the nanopore comes in.How a nanopore reads RNAIn direct RNA sequencing (Oxford Nanopore), a single RNA molecule is pulled through a protein pore in a membrane, tail first. A voltage drives ions through the same pore, and the nucleotides sitting in it – about five at a time in the pore used for this data; Oxford Nanopore says about nine for its newer pores, without publishing the details – partly block that ionic current. The instrument records the current a few thousand times per second. A basecaller, itself a neural network, translates the current back into letters.Inside a long run of As, the current is nearly flat: the pore holds As, then more As. A single C, G or U disturbs it for the few moments it passes through. Here is what that looks like in four molecules from the training data, one per construct: a pure-A tail, and tails with one C, G or U.Plot codereads