Skip to content

Commit

Permalink
closes #279 again (for circular seqs) (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
manulera authored Nov 7, 2024
1 parent 3ab5c7c commit 6ae5986
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pydna/amplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,13 @@ def products(self):
feats = self.template[
fp.position - fp._fp : rp.position + rp._fp
].features # Save features covered by primers
shift_amount = len(fp.tail)
feats = [_shift_feature(f, shift_amount, None) for f in feats]
tpl = self.template
else:
continue
# Shift features to the right if there was a tail
shift_amount = len(fp.tail)
feats = [_shift_feature(f, shift_amount, None) for f in feats]

if tpl.circular and fp.position == rp.position:
prd = _Dseqrecord(fp) + _Dseqrecord(rp).reverse_complement()
else:
Expand Down
5 changes: 5 additions & 0 deletions tests/test_module_amplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,11 @@ def test_annotation():

assert pcr_product.features[0].location.extract(pcr_product).seq == dsr.seq

# Also works in circular sequences
dsr_circ = dsr.looped()
pcr_product_circ = pcr(forward_primer, reverse_primer, dsr_circ)
assert str(pcr_product_circ.features[0].location.extract(pcr_product_circ).seq) == str(dsr_circ.seq)


if __name__ == "__main__":
pytest.main([__file__, "-vv", "-s"])

0 comments on commit 6ae5986

Please sign in to comment.