From eeb93afa7dc1ba0eb2c5a9ce7db8d8d356ba1e7a Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Mon, 13 Feb 2023 10:40:38 +1300 Subject: [PATCH] import: now automatically renames `scientific_name` tag to `SCIENTIFIC_NAME`, and suggests using `--input-na-string` when a sequence import fails --- python/obitools3/commands/import.pyx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/python/obitools3/commands/import.pyx b/python/obitools3/commands/import.pyx index 89cd386..3125a05 100755 --- a/python/obitools3/commands/import.pyx +++ b/python/obitools3/commands/import.pyx @@ -400,12 +400,14 @@ def run(config): for tag in entry : if tag != ID_COLUMN and tag != DEFINITION_COLUMN and tag != NUC_SEQUENCE_COLUMN and tag != QUALITY_COLUMN : # TODO dirty - + value = entry[tag] if tag == b"taxid": tag = TAXID_COLUMN if tag == b"count": tag = COUNT_COLUMN + if tag == b"scientific_name": + tag = SCIENTIFIC_NAME_COLUMN if tag[:7] == b"merged_": tag = MERGED_PREFIX+tag[7:] @@ -418,7 +420,7 @@ def run(config): pass if tag not in dcols : - + value_type = type(value) nb_elts = 1 value_obitype = OBI_VOID @@ -516,7 +518,7 @@ def run(config): dcols[tag][0][i] = value except Exception as e: - print("\nCould not import sequence:", repr(entry), "(error raised:", e, ")") + print("\nCould not import sequence:\n", repr(entry), "\nError raised:", e, "\n/!\ Check if '--input-na-string' option needs to be set") if 'skiperror' in config['obi'] and not config['obi']['skiperror']: raise e else: