You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed today that a feature spanning an entire circular sequence is not properly shifted with Dseqrecord.shifted().
Reproduce with:
test_seq = 'ATCGATCGATCGATCGATCGATCGATCGATCGATCG'
# length of test_seq is 36.
test_seq_dseqrecord = Dseqrecord(test_seq).looped()
test_seq_dseqrecord.add_feature(0,36,type_='test', label='test')
print(f'Features before shifting: {test_seq_dseqrecord.features}')
test_seq_shifted = test_seq_dseqrecord.shifted(10)
print(f'Features after shifting: {test_seq_shifted.features}')
Output:
Features before shifting: [SeqFeature(SimpleLocation(ExactPosition(0), ExactPosition(36), strand=1), type='test', qualifiers=...)]
Features after shifting: []
The expected behavior is observed if the feature is annotated on the interval from [1: len(seq)]:
from pydna.dseqrecord import Dseqrecord
test_seq = 'ATCGATCGATCGATCGATCGATCGATCGATCGATCG'
# length of test_seq is 36.
test_seq_dseqrecord = Dseqrecord(test_seq).looped()
test_seq_dseqrecord.add_feature(1,36,type_='test', label='test')
print(f'Features before shifting: {test_seq_dseqrecord.features}')
test_seq_shifted = test_seq_dseqrecord.shifted(10)
print(f'Features after shifting: {test_seq_shifted.features}')
Output:
Features before shifting: [SeqFeature(SimpleLocation(ExactPosition(1), ExactPosition(36), strand=1), type='test', qualifiers=...)]
Features after shifting: [SeqFeature(CompoundLocation([SimpleLocation(ExactPosition(27), ExactPosition(36), strand=1), SimpleLocation(ExactPosition(0), ExactPosition(26), strand=1)], 'join'), type='test', location_operator='join', qualifiers=...)]
The issue seems to be in dseqrecord.py where the newstart and newend variables are computed. If the feature length is equal to the sequence length, newstart and newend end up being the same, and the feature isn't added.
I noticed today that a feature spanning an entire circular sequence is not properly shifted with
Dseqrecord.shifted()
.Reproduce with:
Output:
The expected behavior is observed if the feature is annotated on the interval from [1: len(seq)]:
Output:
The issue seems to be in dseqrecord.py where the
newstart
andnewend
variables are computed. If the feature length is equal to the sequence length, newstart and newend end up being the same, and the feature isn't added.pydna/src/pydna/dseqrecord.py
Lines 1092 to 1094 in f8d4850
The text was updated successfully, but these errors were encountered: