Skip to content

Commit 31938c7

Browse files
committed
closer to working in circular molecules
1 parent 37106a9 commit 31938c7

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

dummy.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
print("==")
3232
cutsite_pairs = new_seq.get_cutsite_pairs(new_seq.get_ds_meltsites(3))
3333

34+
print(repr(new_seq))
35+
expected_product = new_seq.apply_cut(((10, 6), None), ((4, 4), None))
36+
print(repr(expected_product))
37+
break
38+
3439
print(cutsite_pairs)
3540
print(new_seq.shift_melt_cutsite_pairs(cutsite_pairs))
3641
print(repr(new_seq))

dummy2.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# -*- coding: utf-8 -*-
2+
from pydna.dseq import Dseq
3+
4+
seq = Dseq("AGEEGaGJJJg", circular=True)
5+
6+
cutsite_pairs = seq.get_cutsite_pairs(seq.get_ds_meltsites(3))
7+
8+
shifted_cutsite_pairs = seq.shift_melt_cutsite_pairs(cutsite_pairs)
9+
10+
print(cutsite_pairs)
11+
print(shifted_cutsite_pairs)
12+
assert shifted_cutsite_pairs == [((10, 6), None), ((7, 5), None)]
13+
14+
expected_product = seq.apply_cut(((10, 6), None), ((7, 5), None), allow_overlap=True)

src/pydna/dseq.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,7 +2698,9 @@ def shed_ss_dna(
26982698

26992699
return Dseq.quick(new), strands
27002700

2701-
def apply_cut(self, left_cut: CutSiteType, right_cut: CutSiteType) -> "Dseq":
2701+
def apply_cut(
2702+
self, left_cut: CutSiteType, right_cut: CutSiteType, allow_overlap: bool = False
2703+
) -> "Dseq":
27022704
"""Extracts a subfragment of the sequence between two cuts.
27032705
27042706
For more detail see the documentation of get_cutsite_pairs.
@@ -2753,11 +2755,13 @@ def apply_cut(self, left_cut: CutSiteType, right_cut: CutSiteType) -> "Dseq":
27532755
GttCTTAA
27542756
27552757
"""
2756-
if cuts_overlap(left_cut, right_cut, len(self)):
2758+
2759+
if not allow_overlap and cuts_overlap(left_cut, right_cut, len(self)):
27572760
raise ValueError("Cuts by {} {} overlap.".format(left_cut[1], right_cut[1]))
27582761

27592762
left_watson, left_crick, ovhg_left = self.get_cut_parameters(left_cut, True)
27602763
right_watson, right_crick, _ = self.get_cut_parameters(right_cut, False)
2764+
27612765
return Dseq(
27622766
self[left_watson:right_watson]._data.translate(dscode_to_watson_table),
27632767
self[left_crick:right_crick]

0 commit comments

Comments
 (0)