From f2161dc8fbe8ddf4a6e96b991586eef0a4ed41c7 Mon Sep 17 00:00:00 2001 From: Oliver Schwengers Date: Tue, 8 Oct 2024 14:20:26 +0200 Subject: [PATCH] refactor product amendment in TSV output --- bakta/io/tsv.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bakta/io/tsv.py b/bakta/io/tsv.py index 6c0ba57..ca5bcdf 100644 --- a/bakta/io/tsv.py +++ b/bakta/io/tsv.py @@ -31,16 +31,15 @@ def write_tsv(contigs: Sequence[dict], features_by_contig: Dict[str, dict], tsv_ feat_type = bc.INSDC_FEATURE_ASSEMBLY_GAP if feat['length'] >= 100 else bc.INSDC_FEATURE_GAP gene = feat['gene'] if feat.get('gene', None) else '' + product = feat.get('product', '') if(bc.PSEUDOGENE in feat): - product = f"(pseudo) {feat.get('product', '')}" + product = f"(pseudo) {product}" elif(feat.get('truncated', '') == bc.FEATURE_END_5_PRIME): - product = f"(5' truncated) {feat.get('product', '')}" + product = f"(5' truncated) {product}" elif(feat.get('truncated', '') == bc.FEATURE_END_3_PRIME): - product = f"(3' truncated) {feat.get('product', '')}" + product = f"(3' truncated) {product}" elif(feat.get('truncated', '') == bc.FEATURE_END_BOTH): - product = f"(partial) {feat.get('product', '')}" - else: - product = feat.get('product', '') + product = f"(partial) {product}" fh.write('\t'.join( [ feat['contig'],