The DNA in living organisms like animals or plants comes in pieces of enormous length. To determine its sequence, it has to be cut into pieces, the pieces read separately, and put again together by computer analysis.
To use the simulation, copy the file DNA.py
to your Python path (e.g.
C:\Python24\Lib\site-packages on Windows) and import everything to the Python shell:>>> from DNA import *
Create a DNA sequence by either specifying it by hand as >>> dna = DNA('ACGTACCCGATTAGGCACA')or better, a random sequence of specified length as >>> dna = DNA(length = 3000)
You can see your sequence by typing >>> print dna
Then define some restrictases (enzymes that cut DNA) to cut your DNA into pieces:>>> r1 = Restrictase('AT', 'TA')
>>> r2 = Restrictase('AG', 'GA')
>>> r3 = Restrictase('CG', 'GC')
You should have at least two or three restrictases to ensure that the DNA can be put together well.
Obviously, our r1 cuts DNA between 'AT'
and 'TA'
,>>> r1.cut('ACGTTTCGGATTAGGGC') etc.
['ACGTTTCGGAT', 'TAGGGC']
Cut the DNA and name the lists of pieces like >>> p1 = r1.cut(dna) and put them all together:
>>> p2 = r2.cut(dna)
>>> p3 = r3.cut(dna)>>> p = p1 + p2 + p3
Now create an assembler to restore the original sequence from the pieces:>>> a = DNAassembler()
Let us try out the assembler on two pieces to see how it works:>>> a.assemble(['ACGTTT', 'TTTGCACCGA'])as it should be!
'ACGTTTGCACCGA'
Assemble the DNA>>> assembledDNA = a.assemble(p)and cross your fingers in hope that it is the same as the original sequence:>>> assembledDNA == dna
True
Created: 09.01.2006
Changed: 14.11.2006