From 26b9d12128eef9cc84ae52cf99d2109395f6f972 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Sat, 17 Feb 2018 20:48:52 -0800 Subject: [PATCH] fix genus display if _ is present --- sourmash_lib/lca/command_gather.py | 3 ++- tests/test_lca.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sourmash_lib/lca/command_gather.py b/sourmash_lib/lca/command_gather.py index a1030475b6..8235cf05e5 100644 --- a/sourmash_lib/lca/command_gather.py +++ b/sourmash_lib/lca/command_gather.py @@ -38,7 +38,8 @@ def format_lineage(lineage_tup): name = d['strain'] elif 'species' in present: species = d['species'] - if species.startswith(genus + ' '): + if species.startswith(genus + ' ') or \ + species.startswith(genus + '_'): name = species else: name = '{} {}'.format(genus, species) diff --git a/tests/test_lca.py b/tests/test_lca.py index e72b73d06a..c2c67f3322 100644 --- a/tests/test_lca.py +++ b/tests/test_lca.py @@ -808,7 +808,7 @@ def test_single_gather(): print(out) print(err) - assert '2.0 Mbp 100.0% 100.0% Alteromonas Alteromonas_macleodii' in out + assert '2.0 Mbp 100.0% 100.0% Alteromonas_macleodii' in out assert 'Query is completely assigned.'