BjornFJohansson / pydna

Clone with Python! Data structures for double stranded DNA & simulation of homologous recombination, Gibson assembly, cut & paste cloning.
Other
160 stars 39 forks source link

Overlapping restriction enzymes gives a value error. #224

Open BjornFJohansson opened 2 months ago

BjornFJohansson commented 2 months ago
from Bio.Restriction import AatII, ZraI
from pydna.dseq import Dseq

s = Dseq("GACGTC")

s.cut(AatII)

# (Dseq(-5)
#  GACGT
#  C,
#  Dseq(-5)
#      C
#  TGCAG)

s.cut(ZraI)

# (Dseq(-3)
#  GAC
#  CTG,
#  Dseq(-3)
#  GTC
#  CAG)

s.cut(AatII + ZraI)

# ValueError: Cuts overlap
manulera commented 2 months ago

Hi @BjornFJohansson yes, I added this in the PR about cutsites, the tests for the feature are here:

https://github.com/BjornFJohansson/pydna/blob/989e76eec0e46775aac7df1cab7c957834117608/tests/test_module_dseq.py#L876C46-L930C17

Shouldn't this be the desired behaviour? Or you mean that it should return a different type of error?

BjornFJohansson commented 2 months ago

Not sure yet, This is what happens in the old version. This is not good as it actually hides the problem.

(n39) bjorn@bjorn-ThinkPad-T450s:~$ python
Python 3.9.19 | packaged by conda-forge | (main, Mar 20 2024, 12:50:21) 
[GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from Bio.Restriction import AatII, ZraI
>>> from pydna.dseq import Dseq
>>> s = Dseq("GACGTC")
>>> s.cut(AatII)
(Dseq(-5)
GACGT
C, Dseq(-5)
    C
TGCAG)
>>> s.cut(ZraI)
(Dseq(-3)
GAC
CTG, Dseq(-3)
GTC
CAG)
>>> s.cut(AatII + ZraI)
(Dseq(-3)
GAC
CTG, Dseq(-3)
GTC
CAG)
>>> s.cut(ZraI+AatII)
(Dseq(-3)
GAC
CTG, Dseq(-3)
GTC
CAG)
>>> s.cut(ZraI,AatII)
(Dseq(-3)
GAC
CTG, Dseq(-3)
GTC
CAG)
>>> s.cut(AatII, ZraI)
(Dseq(-5)
GACGT
C, Dseq(-5)
    C
TGCAG)
>>> import pydna
>>> pydna.__version__
'5.2.0'
>>>