Tuesday, 29 December 2009

Code patterns (DNA and other codes)

I didn’t forget that there is still a gap to fill in A Stitch a Day for these days. I felt I take the occasion to introduce code knitting, which makes a huge amount of colour patterns possible.
Since some time I had wondered whether I could use a gene sequence to create a pattern with my technique, or vice versa, depict a gene sequence with it. I didn’t want to copy the DNA shape, rather translate a sequence into a colour pattern. Initially I thought, as there are four elements used in my technique, and four elements in a gene sequence, that I could probably just relate these one to one.

After I was provided on Ravelry with a link to the gene sequence I used I realised after some experiments the original idea doesn’t lead to something meaningful.

The gene sequence is “Ovis aries keratin-associated protein 1-4 (KRTAP1-4) gene, KRTAP1-4-B allele, complete cds” (The sequence is at bottom of the web page)

I don’t know what all that’s in the name means, but ovis aries are sheep, and “Keratins are fibrous proteins that compose a variety of organic materials found in living organisms. They form hard but non-mineralized structures found in birds, reptiles, amphibians and mammals”, such as wool.
I kept thinking, and I feel I’ve come up with something now that has some analogies with DNA and genes. My knowledge about DNA is very basic, however, so I’d be happy to hear the opinions of those that know more about them.

The chart used for this can be used to create a huge amount of other patterns. I’ll show later in the post how one can knit name and birthday code patterns, even poems and other texts, according to a simple letter and number code.

But first back to the DNA and gene sequence.
“To understand DNA's double helix from a chemical standpoint, picture the sides of the ladder as strands of alternating sugar and phosphate groups - strands that run in opposite directions. Each "rung" of the ladder is made up of two nitrogen bases, paired together by hydrogen bonds. Because of the highly specific nature of this type of chemical pairing, base A always pairs with base T, and likewise C with G. So, if you know the sequence of the bases on one strand of a DNA double helix, it is a simple matter to figure out the sequence of bases on the other strand.”

from http://www.genome.gov/25520880#al-7

Many of my patterns are made up of two pairs of rows, each pair knitted in a contrasting colour to that of the other pair. That reminds me of the sugars and phosphates in the DNA, where each base is connected to a sugar and phosphate couple.

After my initial attempts failed, I got the idea to determine four bases, made up of a number and certain order of my four stitch elements. These bases needed to be made up of four rows: of two pairs of rows, each pair in a contrasting colour.

I chose the four bases in the chart below. Others are possible, for example taking only the centre 7 stitches of each. I won’t go into detail why exactly I chose these, just mention that I wanted them to be symmetric, and that they can be combined in any order, or repeated, so that one doesn’t end up with stitches slipped for too many rows.

I then started knitting these bases of the chart in order of the gene sequence. I noticed that the whole sequence would make a very long piece of fabric, so I stuck to the mRNA part, which goes from position 42 to 590. Still, would I knit all that, I’d have a strip of approximately 6m length. So I decided I just start and make a scarf. And probably go on and make more scarves according to the rest of the sequence, when there is time.

Here is the part of my scarf that depicts elements 42 to 82 of the gene sequence. The elements can nicely be counted at the edge, where each “sugar” and “phosphate” appears in the two different colours.

(I must add here that I’ve not indicated edge stitches in the chart. Add two stitches for these when casting on, slip every last stitch with yarn in front, knit every first stitch into back loop, and cross threads when changing colours.)

The clear part would be analogue to a single strand of DNA.

I then completed the chart by adding the bases for the second strand of the DNA, where A always combines with T, and C with G, and vice versa.

Chart 2

When knitting the gene sequence according to this chart, just relate it to the base names at the right; automatically you’ll knit the corresponding base to the left then.

Knitting this chart without horizontal repeats would give the clear part of the scarf in this picture.

The fact that the pattern of each half of this appears at the back of the other half may be seen as a slight analogy to the twisted shape of the DNA?
“DNA's unique structure enables the molecule to copy itself during cell division. When a cell prepares to divide, the DNA helix splits down the middle and becomes two single strands. These single strands serve as templates for building two new, double-stranded DNA molecules - each a replica of the original DNA molecule. In this process, an A base is added wherever there is a T, a C where there is a G, and so on until all of the bases once again have partners.”

As I wanted my scarf to be symmetrical, I knitted one and a half repeats of the chart. This reminds me that in cell division each separated strand combines again with a strand of the other kind. So in a way by knitting several repeats of chart 2 one creates a fabric or tissue in analogy to this.

Here is that part of my scarf seen clear, together with the back of it. See how the two different vertical patterns appear at the back at the position of the other?

I’ve knitted 27 base triplets so far, and the scarf up to now looks like this at front and back:

I hope that all makes sense.

I noticed how the frequency of each base changes within the gene sequence. It would be interesting to see if this is visible if the whole sequence was knitted. Or compare the results of the sequences of different genes. If I only knew what to do with these long knitted pieces.

The chart can, however, also be used for knitting patterns randomly. Just knit any sequence of bases, and as many horizontal repeats as wished. You can use the whole chart, or just the first one with the single strand of bases.

But you may rather wish to use this simple code, where I related numbers and the letters of the alphabet to the four bases.

Here are some examples what one can get:

Here I knitted the code for NOEL = TCAG, using the full chart. I repeated it three times vertically:

Here I knitted the code for KNIT= CTAG, using only the single strand chart, twice vertically:

Here again the code for KNIT, repeated twice, but using the full chart this time:

Here I used the code for KNIT with the single strand chart, but this time inverted the sequence:

Here I knitted the two vertical repeats of the code for today’s date, 29 12 09 = CTTCAT, with the full chart.

And here I used the code for the same date again, full chart, but knitting only the centre seven stitches of each base.

And finally here is, knitted to the full chart, the code for HAPPY NEW YEAR = GAGGA TAC AAAT.


  1. This is completely incredible! And the scarf looks totally amazing. What a fantastic idea Christine - I am totally excited about your way of thinking about knitting!

  2. I want you to do a workshop on dna knitting! ITs the coolest knitted thing I've seen in ages!

  3. Thanks, Snag Breac.

    I'm not yet sure if I got the science right.

  4. OMG this is just awesome!!

  5. hi there. My name is Michelle and I run a knitting group in Roscommon town. This year I have been asked to get a group of knitters together to take part in the Lamb Festival - would you be interested in joining us? You can see some pics of us last year on my blog michellemadethis.blogspot.com (do a search for lamb festival). For some reason I can't paste the code into this comment box. Thanks Michelle

  6. Hi Michelle,

    thank you very much for the invitation. This sounds interesting!

    When is the lamb festival on?