From c969ed93b49f7a8eb3d80df6144d5cc40334743c Mon Sep 17 00:00:00 2001 From: Rachel Colquhoun Date: Wed, 16 Jun 2021 14:22:22 +0100 Subject: [PATCH 1/7] fix bug where scorpio call and no lineage --- pangolin/scripts/pangolearn.smk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pangolin/scripts/pangolearn.smk b/pangolin/scripts/pangolearn.smk index 3d99d64..f80e5dc 100644 --- a/pangolin/scripts/pangolearn.smk +++ b/pangolin/scripts/pangolearn.smk @@ -18,7 +18,7 @@ if config.get("header_file"): ##### Utility functions ##### def expand_alias(pango_lineage, alias_dict): - if not pango_lineage or pango_lineage == "": + if not pango_lineage or pango_lineage in ["None", None, ""]: return pango_lineage lineage_parts = pango_lineage.split(".") From 1ad3988d29de15365f70eba1f1f59643815f0699 Mon Sep 17 00:00:00 2001 From: Rachel Colquhoun Date: Wed, 16 Jun 2021 14:41:05 +0100 Subject: [PATCH 2/7] try to catch --- pangolin/scripts/pangolearn.smk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pangolin/scripts/pangolearn.smk b/pangolin/scripts/pangolearn.smk index f80e5dc..d3a38c4 100644 --- a/pangolin/scripts/pangolearn.smk +++ b/pangolin/scripts/pangolearn.smk @@ -224,7 +224,10 @@ rule generate_report: else: scorpio_lineage = new_row["scorpio_call"].split("+")[0].split("-like")[0] expanded_scorpio_lineage = expand_alias(scorpio_lineage, alias_dict) - expanded_pango_lineage = expand_alias(row['lineage'], alias_dict) + if 'lineage' not in row: + expanded_pango_lineage = "None" + else: + expanded_pango_lineage = expand_alias(row['lineage'], alias_dict) if not expanded_pango_lineage.startswith(expanded_scorpio_lineage): new_row["note"] += f'; scorpio replaced lineage assignment {row["lineage"]}' new_row['lineage'] = scorpio_lineage From 8474e925878a210fa5644144735b510693609014 Mon Sep 17 00:00:00 2001 From: Rachel Colquhoun Date: Wed, 16 Jun 2021 15:03:30 +0100 Subject: [PATCH 3/7] don't fail --- pangolin/scripts/pangolearn.smk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pangolin/scripts/pangolearn.smk b/pangolin/scripts/pangolearn.smk index d3a38c4..a1908a3 100644 --- a/pangolin/scripts/pangolearn.smk +++ b/pangolin/scripts/pangolearn.smk @@ -18,7 +18,7 @@ if config.get("header_file"): ##### Utility functions ##### def expand_alias(pango_lineage, alias_dict): - if not pango_lineage or pango_lineage in ["None", None, ""]: + if not pango_lineage or pango_lineage in ["None", None, ""] or "/" in pango_lineage: return pango_lineage lineage_parts = pango_lineage.split(".") @@ -31,7 +31,7 @@ def expand_alias(pango_lineage, alias_dict): pango_lineage = alias_dict[lineage_parts[0]] lineage_parts = pango_lineage.split(".") if lineage_parts[0] not in ["A","B"]: - sys.exit("Pango lineage %s has no alias provided. Please update aliases JSON" %lineage_parts[0]) + return None return pango_lineage From 588881699201de8510f019f81b14afbd066ef51f Mon Sep 17 00:00:00 2001 From: Rachel Colquhoun Date: Wed, 16 Jun 2021 15:06:32 +0100 Subject: [PATCH 4/7] don't fail --- pangolin/scripts/pangolearn.smk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pangolin/scripts/pangolearn.smk b/pangolin/scripts/pangolearn.smk index a1908a3..7ffe50f 100644 --- a/pangolin/scripts/pangolearn.smk +++ b/pangolin/scripts/pangolearn.smk @@ -228,7 +228,7 @@ rule generate_report: expanded_pango_lineage = "None" else: expanded_pango_lineage = expand_alias(row['lineage'], alias_dict) - if not expanded_pango_lineage.startswith(expanded_scorpio_lineage): + if expanded_scorpio_lineage and expanded_pango_lineage and not expanded_pango_lineage.startswith(expanded_scorpio_lineage): new_row["note"] += f'; scorpio replaced lineage assignment {row["lineage"]}' new_row['lineage'] = scorpio_lineage @@ -354,7 +354,7 @@ rule usher_to_report: scorpio_lineage = scorpio_call.split("+")[0].split("-like")[0] expanded_scorpio_lineage = expand_alias(scorpio_lineage, alias_dict) expanded_pango_lineage = expand_alias(lineage, alias_dict) - if not expanded_pango_lineage.startswith(expanded_scorpio_lineage): + if expanded_scorpio_lineage and expanded_pango_lineage and not expanded_pango_lineage.startswith(expanded_scorpio_lineage): note += f'; scorpio replaced lineage assignment {lineage}' lineage = scorpio_lineage From 878b308f3f59e4e15f2f4f5b7a9213990f4d6228 Mon Sep 17 00:00:00 2001 From: Rachel Colquhoun Date: Wed, 16 Jun 2021 15:23:07 +0100 Subject: [PATCH 5/7] tidy --- pangolin/scripts/pangolearn.smk | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pangolin/scripts/pangolearn.smk b/pangolin/scripts/pangolearn.smk index 7ffe50f..8dd69fa 100644 --- a/pangolin/scripts/pangolearn.smk +++ b/pangolin/scripts/pangolearn.smk @@ -19,7 +19,7 @@ if config.get("header_file"): def expand_alias(pango_lineage, alias_dict): if not pango_lineage or pango_lineage in ["None", None, ""] or "/" in pango_lineage: - return pango_lineage + return None lineage_parts = pango_lineage.split(".") if lineage_parts[0].startswith('X'): @@ -224,10 +224,7 @@ rule generate_report: else: scorpio_lineage = new_row["scorpio_call"].split("+")[0].split("-like")[0] expanded_scorpio_lineage = expand_alias(scorpio_lineage, alias_dict) - if 'lineage' not in row: - expanded_pango_lineage = "None" - else: - expanded_pango_lineage = expand_alias(row['lineage'], alias_dict) + expanded_pango_lineage = expand_alias(row['lineage'], alias_dict) if expanded_scorpio_lineage and expanded_pango_lineage and not expanded_pango_lineage.startswith(expanded_scorpio_lineage): new_row["note"] += f'; scorpio replaced lineage assignment {row["lineage"]}' new_row['lineage'] = scorpio_lineage From 14c11af8b4701d4315cba9eb5229e3b69f7f1061 Mon Sep 17 00:00:00 2001 From: Rachel Colquhoun Date: Thu, 17 Jun 2021 09:39:01 +0100 Subject: [PATCH 6/7] update init --- pangolin/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pangolin/__init__.py b/pangolin/__init__.py index caad58e..146eb61 100644 --- a/pangolin/__init__.py +++ b/pangolin/__init__.py @@ -1,5 +1,5 @@ _program = "pangolin" -__version__ = "3.1.1" +__version__ = "3.1.3" __all__ = ["pangolearn", From ef605a675257afb21747369c7ddbdc2746d79563 Mon Sep 17 00:00:00 2001 From: Rachel Colquhoun Date: Thu, 17 Jun 2021 09:45:11 +0100 Subject: [PATCH 7/7] update help for -dv #252 --- pangolin/command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pangolin/command.py b/pangolin/command.py index 2c4c7b9..15340a4 100644 --- a/pangolin/command.py +++ b/pangolin/command.py @@ -87,7 +87,7 @@ def main(sysargs = sys.argv[1:]): parser.add_argument("-t","--threads",action="store",default=1,type=int, help="Number of threads") parser.add_argument("-v","--version", action='version', version=f"pangolin {__version__}") parser.add_argument("-pv","--pangoLEARN-version", action='version', version=f"pangoLEARN {pangoLEARN.__version__}",help="show pangoLEARN's version number and exit") - parser.add_argument("-dv","--pango-designation-version", action='version', version=f"pango-designation {PANGO_VERSION}",help="show pango-designation version number and exit") + parser.add_argument("-dv","--pango-designation-version", action='version', version=f"pango-designation {PANGO_VERSION} used for pangoLEARN and UShER training",help="show pango-designation version number used for training and exit") parser.add_argument("--aliases", action='store_true', default=False, help="print pango-designation alias_key.json and exit") parser.add_argument("--update", action='store_true', default=False, help="Automatically updates to latest release of pangolin, pangoLEARN and constellations, then exits") parser.add_argument("--update-data", action='store_true',dest="update_data", default=False, help="Automatically updates to latest release of pangoLEARN and constellations, then exits")