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

Update shift_location for origin-wrapping feature with strand None #179

Closed manulera closed 5 months ago

manulera commented 5 months ago

Hi @BjornFJohansson I think this should be the expected behaviour (strand = None same as strand = +1). See the example below, for a feature that wraps around the origin in a molecule of length 12:

from pydna.utils import shift_location
from Bio.SeqFeature import SimpleLocation

for strand in [None, 1, -1]:
    print('strand:', strand)
    print(shift_location(SimpleLocation(10, 14, strand), 0, 12))
    print()

Output is:

strand: None
join{[0:2], [10:12]}

strand: 1
join{[10:12](+), [0:2](+)}

strand: -1
join{[0:2](-), [10:12](-)}

I think for strand == None it should be join{[10:12], [0:2]} which more clearly shows the origin-wrapping nature of the feature.

The tests that fail are the same ones as before the change, so I don't think this breaks anything in the tests

BjornFJohansson commented 5 months ago

Sure!