2025 π Day latest news buy art
syncopation & accordionCafe de Flore (Doctor Rockit)like France, but no dog poopmore quotes
very clickable
Discover all the things that are not trying to make you stronger.
I've encoded DNA in other ways — such as paths.
data visualization + art

Science Advances Cover

6 January 2023, Issue 9, Volume 1

1 · DNA Barcodes

The cover design accompanies the publication of INTERSTELLAR — Kijima, Y. et al. A universal sequencing read interpreter (2023) Science Advances 9. — a kind of universal sequencing read interpreter. Its role is to convert sequencing reads from one sequencing platform to another.

The need for this arises because each platform has a different format for its barcodes that store single cell, spatial and molecular identifiers.

Given that INTERSTELLAR is a kind of “Rosetta Stone” for reads, I thought it would be interesting to try to create something that looked like a puzzle, while encoding barcode sequences from various platforms.

For example, here are some sets of barcodes that all store the same information but vary only by their format.

# 10X, quartz and drop-seq barcodes
ATGAAAGAGCGGGTATCCTTAGTCTTCA TACTACGGTTACGGTGTCTTTT AAAAGGTGTAAATTAACCAC
CCGTGAGAGTTCTGGCCCAGACTTTATT TTACCGTGGCCTCTTTGCTAGG AAAGTGCCACAACTGCGGAA
GCATGATGTCAAGCAGTGCAGGTCCTTG TCTCACTTCACTCCGCTCGCGG AAAATCAGTACGCGGAGTGA
GAGAGGTTCCCAATAGCTCTGCTATGGC ACTTCAATTCTGCCGTATATAT AAATCCATAGAGGGCCACGA
GTGTCCTCAGACAGCATGGTTTATTCGC GCGCAATAGTCTCCAGGGGCGG AAATGGGGTCAGCCAGTTCG
...

2 · Encoding

Barcode bases are encoded onto the 2-dimensional faces of hypercubes by oriented triangles.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
The four DNA bases are encoded onto faces of a hypercube with oriented triangles. Optionally, a shrinking factor can be applied to make the triangle smaller.

Bases are assigned to faces by traversing the faces in order of the coordinates that correspond to the face's plane.

For example, suppose we want to encode ATGAAA onto a 3-dimensional cube. The cube has 6 faces, which we enumerate as follows

[0] xy x,y,0 A
[1] xy x,y,1 T
[2] xz x,0,z G
[3] xz x,1,z A
[4] yz 0,y,z A
[5] yz 1,y,z A

The first is the face in the `xy` plane at `z=0`, the second in the `xy` plane at `z=1`. We then advance to the next dimension for the second component of the plane coordinate — bringing us to the `xz` plane at `y=0` and `y=1`.

When we go to higher dimensions, the sample process applies. Except now, we have more faces — `2^d` for `d` dimensions. For example, a `d=5` cube has 80 faces to which we can encode 80 bases as follows.

[0]xy000A [1]xy001T [2]xy010G [3]xy011A [4]xy100A [5]xy101A [6]xy110G [7]xy111A [8]x0z00G [9]x0z01C [10]x0z10G [11]x0z11G [12]x1z00G [13]x1z01T [14]x1z10A [15]x1z11T [16]x00u0C [17]x00u1C [18]x01u0T [19]x01u1T [20]x10u0A [21]x10u1G [22]x11u0T [23]x11u1C [24]x000vT [25]x001vT [26]x010vC [27]x011vA [28]x100vC [29]x101vC [30]x110vG [31]x111vT [32]0yz00G [33]0yz01A [34]0yz10G [35]0yz11A [36]1yz00G [37]1yz01T [38]1yz10T [39]1yz11C [40]0y0u0T [41]0y0u1G [42]0y1u0G [43]0y1u1C [44]1y0u0C [45]1y0u1C [46]1y1u0A [47]1y1u1G [48]0y00vA [49]0y01vC [50]0y10vT [51]0y11vT [52]1y00vT [53]1y01vA [54]1y10vT [55]1y11vT [56]00zu0G [57]00zu1C [58]01zu0A [59]01zu1T [60]10zu0G [61]10zu1A [62]11zu0T [63]11zu1G [64]00z0vT [65]00z1vC [66]01z0vA [67]01z1vA [68]10z0vG [69]10z1vC [70]11z0vA [71]11z1vG [72]000uvT [73]001uvG [74]010uvC [75]011uvA [76]100uvG [77]101uvG [78]110uvT [79]111uvC

Here, I've shortened how a face is described. For example xy011A is the face in the `xy` plane at `z=0, u=1, v=1` on which we encode an A.

3 · Decoding

Given a hypercube whose faces encode a sequence, to decode the sequence we need to know the orientation of unit axes in space. This allows us to figure out the coordinates of each vertex.

Once we have the coordinates, we traverse the faces in the order described above and look at its triangle. If the triangle has a corner at `[0,0]` of the face plane, then the base is an A. If the triangle has a corner at [0,1]`, it's a C. And so on.

For example, a face x0z11 will be a square in the `xz` plane. If we see a tringle corner at `(x,z) = (0,0)`, then we have an A.

You can't easily decode the sequence from a 2-dimensional image of a cube — even if the coordinate axes were shown, some faces would be hidden by others in the image (especially as the number of dimensions is increased).

4 · Prototypes

The code that creates the images is based on the work I did for Max Cooper's Ascent video from his Unspoken Words album.

My animation of 5 dimensions sets the stage for Max Cooper's track Ascent from his new album Unspoken Words.

Below, I'll walk through some early prototypes of the design. Each shows an array of 4 × 4 cubes encoding random sequence. Each cube is randomly rotated.

5 · 3 and 6 dimensions, black-and-white

Even with only black and white, if I use a difference blend (e.g. white on white makes black, and vice versa), interesting patterns emerge.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 3-dimensional cubes encoding random sequences.

If I start to shrink the triangles towards their corners (here by 50%), the design gains space and the arrangements of triangles becomes even more interesting.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 3-dimensional cubes encoding random sequences. Triangles are shrunk by 50% towards their corners.

Shrinking the triangles even more (by 75%), we start to see even more room — perfect to accomodate more dimensions.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 3-dimensional cubes encoding random sequences. Triangles are shrunk by 75% towards their corners.

When we go to `d=6` dimensions, our cubes now have 192 faces. In this image, edges are also drawn. You can see how diverse the 2-dimensional projections are. These images are very similar to the scene at 1:44 in the Ascent video, with the only difference being that Ascent uses `d=5` and (at this point in the video) the cube corners have not yet appeared.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 6-dimensional cubes encoding random sequences. Triangles are shrunk by 75% towards their corners.

Once we hide the edges, the corners, how by themselves, give a sense of a flock of birds.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 6-dimensional cubes encoding random sequences. Triangles are shrunk by 75% towards their corners.

Rich complexity in the patterns arise when we enlarge the triangles ‐ here shrunk by only 50%.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 6-dimensional cubes encoding random sequences. Triangles are shrunk by 75% towards their corners.

6 · 6 dimensions, viridis palette

Time for some color. I took the viridis color maps and filled the triangles with a gradient that mapped their z coordinate.

Below are takes that use the viridis color map with half- and full-sized triangles.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 6-dimensional cubes encoding random sequences. Triangles are shrunk by 50% towards their corners. Viridis color map.
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 6-dimensional cubes encoding random sequences. Triangles are drawn at full size. Viridis color map.

7 · 6 dimensions, inferno palette

While I found the viridis scheme to be a little too cold, the inferno palette feld just the right amount of warmth.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 6-dimensional cubes encoding random sequences. Triangles are shrunk by 50% towards their corners. Inferno color map.
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 6-dimensional cubes encoding random sequences. Triangles are drawn at full size. Inferno color map.

8 · 4 dimensions, jewels

I also experimented with blending two color maps together when the full face was drawn. These don't encode any sequence, but have a very pretty look to them.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 4-dimensional cubes. Faces are fully filled (no sequence is encoded). Viridis color map.
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 4-dimensional cubes. Faces are fully filled (no sequence is encoded). Inferno color map.
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 4-dimensional cubes. Faces are fully filled (no sequence is encoded). A blend of two cubes that use viridis and inferno color maps.

These all look like jewels and at `d=6`, a blend of three cubes, each with a different color map, looks very intriguing. Hhere, I blend three cubes that use viridis, inferno and magma color maps. Magma is very similar to inferno, except it tends more towards the purple at its centre.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
An array of 6-dimensional cubes. Faces are fully filled (no sequence is encoded). A blend of three cubes that use the viridis, inferno and magma color maps.

9 · Creating the designs

Below, I show all individual images from which I made selections for a given version of the final design. There were 6 designs.

9.1 · Source images

For each of the 3 sequence platforms, I tried inferno, plasma, magma, turbo, viridis, mako and white color maps. The inferno, magma and plasma maps are practically identical. For subsequent designs, I won't show images that use the magma or plasma maps.

The final designs all show three superimposed cubes, each with its own rotation. Two cubes use a color map and one is drawn with white triangles — blended together with various Photoshop blend modes.

9.2 · 6 dimensions, close crop

The first design is a close crop of the cubes. Below I show all the images by color map and platform.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
magma 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
magma 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
magma 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
turbo 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
turbo 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
turbo 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
viridis 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
viridis 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
viridis 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
mako 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
mako 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
mako 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 3/3

The design used the inferno color maps for 10X and Quartz layers and the white map for the Drop-seq layers. Below, I show how these were blended together.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 1/6. Layer 1, inferno blend, 10X sequence
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 1/6. Layers 1+2, adding inferno pin light blend, Quartz sequence
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 1/6. Layers 1+2+3, adding white hue blend Drop-seq sequence.
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 1/6. Final version with curves, levels, vibrance and hue/saturation modifications.

9.3 · 7 dimensions, loose crop

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 3/3

Blending two inferno cubes creates a lot of saturated colors, without a strong sense of depth. The third layer (white, hue blend) very nicely creates a tapering off effect.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 2/6. Layer 1, inferno 10X sequence
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 2/6. Layers 1+2, adding plasma pin light blend Quartz sequence.
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 2/6. Layers 1+2+3, adding white hue blend Drop-seq sequence.

9.4 · 4 dimensions, 4 cubes

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 3/3

Although this design only uses `d=4` dimensions, it's one of my favourites. It's the only one that shows an array of cubes. In each cell of the array, you see the same set of three cubes (for each of the sequencing platforms) — the only thing that is different is the rotation.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 3/6. Layer 1, inferno 10X sequence
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 3/6. Layers 1+2, adding plasma hard light blend Quartz sequence.
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 3/6. Layers 1+2+3, adding white hue blend Drop-seq sequence.

9.5 · 4 dimensions, 1 cube

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 3/3

The simplest of all designs — and my favourite. The magic sauce in this design is the soft light blend mode for the second cube.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 4/6. Layer 1, inferno 10X sequence
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 4/6. Layers 1+2, adding plasma soft light blend Quartz sequence.
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 4/6. Layers 1+2+3, adding white hue blend Drop-seq sequence.

9.6 · 8 dimensions, small triangles

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 3/3

At `d=8` dimensions, each cube has 1,792 faces. In total, there is about 5.3 kb of sequence encoded here.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 5/6. Layer 1, inferno 10X sequence
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 5/6. Layers 1+2, adding plasma hard light blend Quartz sequence.
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 5/6. Layers 1+2+3, adding white hue blend Drop-seq sequence.

9.7 · 9 dimensions, small triangles

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
inferno 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
plasma 3/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 1/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 2/3
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
white 3/3

The last design pushes to `d=9` dimensions, where now a cube has 4,608 faces.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 6/6. Layer 1, inferno 10X sequence
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 6/6. Layers 1+2, adding plasma hard light blend Quartz sequence.
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 6/6. Layers 1+2+3, adding white hue blend Drop-seq sequence.
Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Cover design, 6/6. Different color treatment of the final blend.
news + thoughts

Propensity score weighting

Mon 17-03-2025

The needs of the many outweigh the needs of the few. —Mr. Spock (Star Trek II)

This month, we explore a related and powerful technique to address bias: propensity score weighting (PSW), which applies weights to each subject instead of matching (or discarding) them.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Nature Methods Points of Significance column: Propensity score weighting. (read)

Kurz, C.F., Krzywinski, M. & Altman, N. (2025) Points of significance: Propensity score weighting. Nat. Methods 22:1–3.

Happy 2025 π Day—
TTCAGT: a sequence of digits

Thu 13-03-2025

Celebrate π Day (March 14th) and sequence digits like its 1999. Let's call some peaks.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
2025 π DAY | TTCAGT: a sequence of digits. The digits of π are encoded into DNA sequence and visualized with Sanger sequencing. (details)

Crafting 10 Years of Statistics Explanations: Points of Significance

Sun 09-03-2025

I don’t have good luck in the match points. —Rafael Nadal, Spanish tennis player

Points of Significance is an ongoing series of short articles about statistics in Nature Methods that started in 2013. Its aim is to provide clear explanations of essential concepts in statistics for a nonspecialist audience. The articles favor heuristic explanations and make extensive use of simulated examples and graphical explanations, while maintaining mathematical rigor.

Topics range from basic, but often misunderstood, such as uncertainty and P-values, to relatively advanced, but often neglected, such as the error-in-variables problem and the curse of dimensionality. More recent articles have focused on timely topics such as modeling of epidemics, machine learning, and neural networks.

In this article, we discuss the evolution of topics and details behind some of the story arcs, our approach to crafting statistical explanations and narratives, and our use of figures and numerical simulations as props for building understanding.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Crafting 10 Years of Statistics Explanations: Points of Significance. (read)

Altman, N. & Krzywinski, M. (2025) Crafting 10 Years of Statistics Explanations: Points of Significance. Annual Review of Statistics and Its Application 12:69–87.

Propensity score matching

Mon 16-09-2024

I don’t have good luck in the match points. —Rafael Nadal, Spanish tennis player

In many experimental designs, we need to keep in mind the possibility of confounding variables, which may give rise to bias in the estimate of the treatment effect.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Nature Methods Points of Significance column: Propensity score matching. (read)

If the control and experimental groups aren't matched (or, roughly, similar enough), this bias can arise.

Sometimes this can be dealt with by randomizing, which on average can balance this effect out. When randomization is not possible, propensity score matching is an excellent strategy to match control and experimental groups.

Kurz, C.F., Krzywinski, M. & Altman, N. (2024) Points of significance: Propensity score matching. Nat. Methods 21:1770–1772.

Understanding p-values and significance

Tue 24-09-2024

P-values combined with estimates of effect size are used to assess the importance of experimental results. However, their interpretation can be invalidated by selection bias when testing multiple hypotheses, fitting multiple models or even informally selecting results that seem interesting after observing the data.

We offer an introduction to principled uses of p-values (targeted at the non-specialist) and identify questionable practices to be avoided.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Understanding p-values and significance. (read)

Altman, N. & Krzywinski, M. (2024) Understanding p-values and significance. Laboratory Animals 58:443–446.

Martin Krzywinski | contact | Canada's Michael Smith Genome Sciences CentreBC Cancer Research CenterBC CancerPHSA
Google whack “vicissitudinal corporealization”
{ 10.9.234.152 }