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

Inconsisten behaviour of features when calling dseqrecord.shifted depending on strand #195

Closed manulera closed 5 months ago

manulera commented 5 months ago

Can be reproduced with the code below. In essence:

I think the desired behaviour is that of the + strand feature.

from pydna.dseqrecord import Dseqrecord
from Bio.SeqFeature import SeqFeature, SimpleLocation

dseqr = Dseqrecord('ACCGTT', circular=True )

dseqr.features = [SeqFeature(SimpleLocation(0, 2, 1))]

print(dseqr.features[0].location)
print(dseqr.shifted(1).features[0].location)
print(dseqr.shifted(1).shifted(-1).features[0].location)
# Prints
# [0:2](+)
# join{[5:6](+), [0:1](+)}
# [0:2](+)
print()

dseqr.features = [SeqFeature(SimpleLocation(0, 2, -1))]
print(dseqr.features[0].location)
print(dseqr.shifted(1).features[0].location)
print(dseqr.shifted(1).shifted(-1).features[0].location)
# Prints
# [0:2](-)
# join{[0:1](-), [5:6](-)}
# join{[1:2](-), [0:1](-)}