Skip to content

Commit

Permalink
fix small error
Browse files Browse the repository at this point in the history
  • Loading branch information
manulera committed Jan 25, 2024
1 parent 14eca74 commit be81493
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/pydna/dseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ def get_cut_parameters(self, cut: tuple, is_left: bool):
if is_left:
return *self.left_end_position(), self.ovhg
# In the right end, the overhang does not matter
return *self.right_end_position(), None
return *self.right_end_position(), self.watson_ovhg()

def apply_cut(self, left_cut, right_cut):
"""Extracts a subfragment of the sequence between two cuts.
Expand Down
3 changes: 0 additions & 3 deletions src/pydna/dseqrecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -1402,9 +1402,6 @@ def apply_cut(self, left_cut, right_cut):
left_watson, left_crick, left_ovhg = self.seq.get_cut_parameters(left_cut, True)
right_watson, right_crick, right_ovhg = self.seq.get_cut_parameters(right_cut, False)

# left_watson, left_crick = left_cut[0] if left_cut is not None else (0, 0)
# right_watson, right_crick = right_cut[0] if right_cut is not None else (None, None)

left_edge = left_crick if left_ovhg > 0 else left_watson
right_edge = right_watson if right_ovhg > 0 else right_crick
features = self[left_edge:right_edge].features
Expand Down
4 changes: 2 additions & 2 deletions tests/test_module_dseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ def test_get_cut_parameters():

dseq = Dseq.from_full_sequence_and_overhangs('aaaACGTaaa', 3, 3)
assert dseq.get_cut_parameters(None, True) == (*dseq.left_end_position(), dseq.ovhg)
assert dseq.get_cut_parameters(None, False) == (*dseq.right_end_position(), None)
assert dseq.get_cut_parameters(None, False) == (*dseq.right_end_position(), dseq.watson_ovhg())

assert dseq.get_cut_parameters(((4, -2), None), True) == (4, 6, -2)
assert dseq.get_cut_parameters(((4, -2), None), False) == (4, 6, -2)
Expand All @@ -994,7 +994,7 @@ def test_get_cut_parameters():
assert False, 'Expected AssertionError'

try:
assert dseq.get_cut_parameters(None, False) == (*dseq.right_end_position(), None)
assert dseq.get_cut_parameters(None, False) == (*dseq.right_end_position(), dseq.watson_ovhg())
except AssertionError as e:
assert e.args[0] == 'Circular sequences should not have None cuts'
else:
Expand Down

0 comments on commit be81493

Please sign in to comment.