diff --git a/bakta/io/gff.py b/bakta/io/gff.py index e963c30c..458ea226 100644 --- a/bakta/io/gff.py +++ b/bakta/io/gff.py @@ -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): diff --git a/bakta/io/insdc.py b/bakta/io/insdc.py index c4fae50d..892a9ab4 100644 --- a/bakta/io/insdc.py +++ b/bakta/io/insdc.py @@ -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",