Skip to content

Commit

Permalink
fix backward compatibility issue in GFF3/INSDC
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwengers committed Dec 2, 2024
1 parent ff72dda commit 093204d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bakta/io/gff.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def write_features(data: dict, features_by_sequence: Dict[str, dict], gff3_path:
fh.write(f"{seq['id']}\tBakta\tregion\t1\t{str(seq['length'])}\t.\t+\t.\t{annotations}\n")

for feat in features_by_sequence[seq['id']]:
seq_id = seq_id if 'sequence' in feat else feat['contig'] # <1.10.0 compatibility
seq_id = feat['sequence'] if 'sequence' in feat else feat['contig'] # <1.10.0 compatibility
start = feat['start']
stop = feat['stop']
if('edge' in feat):
Expand Down
4 changes: 3 additions & 1 deletion bakta/io/insdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
def build_biopython_sequence_list(data: dict, features: Sequence[dict]):
sequence_list = []
for seq in data['sequences']:
sequence_features = [feat for feat in features if feat['sequence'] == seq['id']] if 'sequence' in features[0] else [feat for feat in features if feat['contig'] == seq['id']] # <1.10.0 compatibility
sequence_features = []
if len(features) > 0:
[feat for feat in features if feat['sequence'] == seq['id']] if 'sequence' in features[0] else [feat for feat in features if feat['contig'] == seq['id']] # <1.10.0 compatibility
comment = (
'Annotated with Bakta',
f"Software: v{bakta.__version__}\n",
Expand Down

0 comments on commit 093204d

Please sign in to comment.