Skip to content

Commit

Permalink
speed improvment
Browse files Browse the repository at this point in the history
  • Loading branch information
Juke34 committed Apr 17, 2019
1 parent e5ade4a commit 76916c5
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions EMBLmyGFF3/EMBLmyGFF3.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,16 @@ def _add_mandatory(self):
# Make sure that there's a gap feature for every span of n's
seq = str(self.record.seq).lower() if self.record else ""
try:
index_position = seq.index('n')
while index_position:
start = index_position
logging.debug("There is gap starting at position %s", index_position)
end = first_nonrepeated_char(seq, index_position,'n')
start = seq.index('n')
while start:
logging.debug("There is gap starting at position %s", start)
# Now find the end
end = start + 1
while end:
if seq[end] == 'n' :
end +=1
else:
break

found = False
for f in [f for f in self.record.features if f.type == 'gap']:
Expand All @@ -205,7 +210,9 @@ def _add_mandatory(self):
self.record.features += [gap_feature]
if EMBL.total_features:
EMBL.total_features += 1
index_position = seq.index('n',end)
# Move +1 to start back from outside the gap
end +=1
start = seq.index('n',end)

except ValueError as e:
#logging.error(e)
Expand Down

0 comments on commit 76916c5

Please sign in to comment.