The Science How gene expression becomes an instrument

Arabidopsis thaliana is a plant that scientists love to study. Yuchen Yang and colleagues grew Arabidopsis under 16hr light and 8hr dark cycles, and measured the activity of each of the roughly 27,000 genes every three hours for two days.

Here is TOC1 (AT5G61380), a known circadian gene, alongside PP2AA3 (AT1G13320), a housekeeping (non-oscillating) gene:

We can “hear” the data if we treat the resulting plot as an audio waveform.


An audio waveform is a representation of sound:

Amplitude controls volume.
Frequency (how fast the waveform repeats) controls pitch.
Shape of the waveform controls timbre. Think of each unique shape as its own instrument!

For the synthesizer below, amplitude is locked and frequency is mapped to the keyboard, so you can focus on waveform shape. That gives about 19,200 (after filtering from 27,000) “instruments” derived from the Arabidopsis genome.

How would we expect oscillating and non-oscillating genes to sound different? You can explore the interactive synthesizer below to figure it out for yourself, or go to the discussion section below for spoilers.

How To Quick guide and orientation

Picking a Sound

Click on a circle in any of the two linked plots below: "Group by Biology" or "Group by Sound".

Group by Biology

Tries to place similar points together based on experimental data.

Group by Sound

Tries to place similar points together based on the waveform's sound. It uses the same data but discards phase information. For sound, what matters is the component frequencies of each wave, and shifting the wave in time does not change this information.

Each point is a gene. Click to select. Click away to cancel. Hover highlights the same gene in both views. Other parts of the dashboard will update as you select a gene.

Playing a Sound

Click the virtual keyboard at the bottom or use the corresponding keys on your keyboard to play the selected gene's waveform. Polyphony is supported (i.e. multiple notes at once). The up and down arrows to the right control the octave.

If you feel intimidated by the piano keyboard, just load up a gene and press "adgj" (maj7) together on your keyboard and feel the jazziness.

Coloring the Graph

The best way to explore the plots is by coloring them. Selecting any of the coloring modes updates the plots. As you change colors, the hint box below will update to give more details.

Filtering

Filtering is a great way to explore the colored graph dynamically. Here is a . The vertical plot between the two larger plots is called a violin plot. The top and bottom circles can be clicked and dragged to set the upper and lower filtering thresholds. The body of the window can be dragged and repositioned as well. The filter updates based on the coloring mode.

Energy %

Below the three plots is a narrow horizontal plot showing the energy % of the selected wave's component frequencies. The frequency components strongly affect how the waveform sounds. The stronger the high frequency components (periods shorter than 24 hr), the "brighter" the sound. The discussion below has more details.

Waveform

All Genes Mode

The waveform above the keyboard displays the experimental data of the selected gene. The line is an interpolation through the data. The interpolation is used to generate the sounds you hear.

Circadian Mode

Instead of simple interpolation, circadian genes can be modeled. The model starts by assuming a smooth curve that repeats every 24hrs. The model compares day 1 vs day 2 of the experimental data, and the less they agree, the less confident we are of the shape of the wave.

When you play a sound, the model generates one possible waveform that fits the experimental data every 50ms. The teal line is the average and the teal band is the 95% confidence interval. The sound you hear morphs between the sampled waveforms, so the wobble you hear matches the certainty of the shape.

All genes vs Circadian

Display all genes or only circadian ones. Some coloring modes change subtly, so keep an eye on the help text. The waveform (and sound) also changes.

Jukebox

Clicking on the Jukebox sidebar slides the jukebox in and out of frame. There is a MIDI song loaded, but you need to assign sounds (genes) to each track to hear it. If you have a gene you like after playing it, you can load it into the jukebox by picking a track and clicking the "Assign" button.

Color UMAP by:

Genes shown:

Selected
—
Hover
—
Waveform No gene selected
Send to Jukebox

Assign to a track

Discussion Oscillating data and sound quality

Graph Grouping

These plots are UMAPs: each point is a gene, and genes with similar profiles are placed near each other. Only the local neighborhoods are meaningful; the distances between far-apart clusters and the sizes of clusters are not.

All Genes Mode

In "Group by Biology", you will notice the organizing principles are "peak time" and oscillation energy. In "Group by Sound", only the strength of each frequency component is kept and phase is discarded. Because the sound loops indefinitely, shifting the peak time only changes where the loop starts, which you can't hear. So the plot is organized only by how the oscillation energy is split across frequencies.

Circadian Mode

"Group by Biology" is still strongly organized by "peak time", but "Group by Sound" no longer separates genes by their dominant frequency, because only genes MetaCycle calls circadian (20–28 hr period, q ≤ 0.01) are kept, and nearly all of them are dominated by the 24 hr component. Instead, the plot is largely organized by waveform confidence (the Gaussian Process fit quality), which tracks how noisy the data is.

Sonic Grouping

Because we're comparing the shapes of waveforms between genes, the sonic profile is determined by the frequency composition of each waveform (shown in the oscillation energy colorings and the energy % plot). Two closely related things are at play here: brightness and pitch.

With 16 time points spanning 48 hrs, a Fourier transform can resolve at most 8 frequency components above the mean. These components are called harmonics. Each harmonic is a whole-number multiple of the fundamental frequency, which here is one cycle per 48 hrs, that's the length of the experiment. The table below shows each harmonic's period and the musical interval it forms with the fundamental:

Harmonic Ratio Interval above fundamental Period (hrs)
1st (fundamental) 1:1 Unison 48
2nd 2:1 Octave 24
3rd 3:1 Octave + perfect fifth 16
4th 4:1 2 octaves 12
5th 5:1 2 octaves + major third 9.6
6th 6:1 2 octaves + perfect fifth 8
7th 7:1 2 octaves + minor seventh 6.9
8th 8:1 3 octaves 6

The blending of harmonics is hard to explain with words, so before we continue exploring the topic of harmonics, here's a applet you can come back to and experiment as we go! Each slider sets that harmonic's share of the energy. The fundamental (1st harmonic) starts at 440 Hz. Hearing the same note over and over can be distracting, so while the mixer plays, the synth keyboard changes the drone's pitch.

Since each harmonic has a higher frequency than the fundamental, when played alone each one would have a different pitch. But when you mix them together, something interesting happens. Human ears tend to fuse a set of related harmonics into a single note at the fundamental's pitch, with varying "brightness". The stronger the higher-frequency components, the brighter the sound.

Interestingly, even if the fundamental is completely missing, as long as the higher harmonics are present we still tend to hear the note as the fundamental. It's called the missing fundamental. Psychoacoustics is wild.

This means that using the filters above, you can narrow down sounds of varying brightness by finding genes with a progressively higher % of energy in the higher harmonics. But a few interesting cases stand out in the dataset.

Some genes are true circadian genes that oscillate every 24 hrs. Their 24 hr component can be so dominant that the line between pitch and brightness begins to blur. If a waveform repeats every 24 hrs within the 48 hr window, its true fundamental really is 24 hrs. The same goes for genes with a prominent 12 hr period, which sound two octaves higher. In this dataset, no other harmonic is as dominant as the 48, 24, and 12 hr components. If you pick a gene with a really strong 16 hr harmonic, it will likely sound brighter rather than jumping up an octave and a fifth.

Circadian Mode

The pitch jumps really only apply in "All Genes Mode". Since only genes oscillating around 24 hrs are kept, most of the differences you hear will be in brightness. However, the most prominent difference you will notice is the "wobble". The sound morphs continuously between random waveforms drawn from the gene's Gaussian Process fit, so the less confident the fit, the more the waveform (and the sound) wobbles. I absolutely love the sound.

Picking Sounds for Jukebox

In audio mixing, giving instruments their own frequency ranges so they don't overlap keeps the music from sounding muddy. In "All Genes Mode", we have three main registers (48, 24, and 12 hrs). Genes dominated by the 12 hr component sit two octaves above the 48 hr ones and suit lead parts like vocals or brass. Genes dominated by the 48 hr component sit lowest and suit the bass.

Methods

Processing Raw Reads

The Diurnal Dataset from Yuchen Yang and colleagues was downloaded from GSE137732. This is a bulk RNA-seq dataset from Arabidopsis grown under long-day conditions (16hr light / 8hr dark).

The paired-end reads were processed with fastp with "--detect_adapter_for_pe". Results before and after trimming were checked using MultiQC. Fragments were mapped to the TAIR10 transcriptome and transcripts were counted using salmon, with the genome as decoy.

DESeq2: adjusting for differences in sequencing depth and RNA composition

DESeq2 was used to normalize the samples after using tximport to summarize transcript-level data. Genes with fewer than 5 average DESeq2 normalized counts across all samples were dropped.

TPM: adjusting for differences in gene length

Log10 of the mean salmon TPM across the 16 samples was kept as a filtering metric for the violin plot.

VST: adjusting for heteroskedasticity

VST was performed and the output was used for all the rest of the downstream steps: UMAP, Lomb-Scargle, MetaCycle, Sound generation, and Gaussian Process modeling.

Sound Generation

VST or sampled GP waves for the selected gene are interpolated with Catmull-Rom then mean centered then max-absolute scaled to place the data between -1 and 1 to be treated as audio signal.

UMAPs

Counts

VST data for each gene is z-score normalized across the 16 timepoints before running UMAP with n_neighbors = 10, min_dist = 0.25, and metric = "cosine". Distance between points is (1 - Pearson correlation). "Circadian Mode" reruns the UMAP on only the filtered genes. In All Genes Mode, peak time (used for coloring and filtering) is the sample hour with the highest VST value; no period is fitted and the 48 hours are not folded.

FFT

Each gene's VST was interpolated using Catmull-Rom, mean centered, and max-absolute scaled to between -1 and 1. The first 8 frequency components (not including DC) are kept for UMAP. This is because the original data only has 16 points, which only gives 8 frequency components. Interpolation does not give new information. UMAP is run with n_neighbors = 10, min_dist = 0.25, and metric = "euclidean". "Circadian Mode" reruns the UMAP on only the filtered genes.

Oscillating Gene Detection

The Lomb-Scargle algorithm from astropy was used to detect inherent rhythms using VST from all genes with a search grid of minimum_frequency = 1/48; maximum_frequency = 1/6; samples_per_peak = 30. The maximum of 1/6 is due to the Nyquist frequency. Taking the False Alarm Probabilities (FAP) and accounting for multiple-testing with Benjamini/Hochberg, q-value is calculated. The q-value is used for coloring and filtering in All Genes Mode.

The MetaCycle R package is used specifically for circadian gene detection. The default search range of 20~28hrs is used. Phase and q-value from the MetaCycle result are used for coloring and filtering in Circadian Mode. A q-value of 0.01 or less is considered circadian.

Gaussian Process Modeling

For circadian genes (MetaCycle q-value ≤ 0.01), a Gaussian Process was used to model the waveform from VST data. GPflow was used to fit the GP model with a fixed period of 24 hrs and a Periodic kernel with a SquaredExponential base kernel. After fitting multiple low q-value genes with different starting length scales without a prior, length scale was found to be around 0.4 ~ 0.5. 0.4 was chosen to be the initial length scale and prior. The kernel variance is initialized to the variance, and the mean to the mean, of all measurements for the gene. Multiple QC metrics are derived but as they mostly correlate well with a Spearman correlation of 0.7~0.9, only the relative std is kept as a metric for fit quality.

Limitations

  • Expression strength is currently not mapped to anything sonically, and is only used as a filter, to not distract from the harmonics.
  • In all genes mode, the gene is played as if it perfectly loops around after 48 hours, which non-circadian genes certainly don't. So even though genes with strong oscillation at 48hrs make up an important group, they're not really oscillating at 48hrs. Even circadian genes will not perfectly loop indefinitely.
  • Uncertainty in period estimation isn't reflected in the Gaussian Process modeling.
  • The same smoothing function (Catmull-Rom) is used on every waveform, so they all sound like the same family of instruments.