In [1]:
from pydna.dseq import Dseq
In [2]:
seq = Dseq("GGATCCAAA","TTTGGATCC", ovhg=0)
seq
Out[2]:
The Dseq class is the main pydna data type together with the Dseqrecord class which is a double stranded version of the BioPython SeqRecord class.
The Dseq object was initialized using two strings and a value for the stagger (ovhg) between the DNA strands in the 5' (left) extremity. This is of course not a practical way of creating a Dseq object in most cases, but there are other methods as we will see further on.
The Dseq object comes with a cut method that takes one or more restriction enzymes as arguments. A list is returned with the fragments produced in the digestion:
In [3]:
from Bio.Restriction import BamHI
a, b = seq.cut(BamHI)
The two fragments formed (a and b) have the structure we would expect.
In [4]:
a
Out[4]:
In [5]:
b
Out[5]:
The fragments a and b formed in the example above can be religated together by simply adding them together.
a+b gives us the old fragment back.
In [6]:
a+b
Out[6]:
b+a gives us a fragment with the sticky ends facing outwards.
In [7]:
b+a
Out[7]:
We can add as many fragment together as we want, as long as the sticky ends are compatible.
In [8]:
b+a+b
Out[8]:
Adding sequences together (ligation) will not work if the sticky ends are not compatible. The Dseq objects keep track of the structure of the DNA ends and only allow ligation of compatible fragments. The last line of the error message below gives an idea of what is wrong.
In [9]:
# NBVAL_RAISES_EXCEPTION
b+a+a
The Dseq class is not often used directly. The Dseqrecord class provides a Dseq object to hold the sequence information as well as other class