diff --git a/pangolin/__init__.py b/pangolin/__init__.py index 7ab1ce2..bdaa721 100644 --- a/pangolin/__init__.py +++ b/pangolin/__init__.py @@ -1,6 +1,5 @@ _program = "pangolin" -__version__ = "3.1.2" - +__version__ = "3.1.3" __all__ = ["pangolearn", "utils"] 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") diff --git a/pangolin/scripts/pangolearn.smk b/pangolin/scripts/pangolearn.smk index 3d99d64..8dd69fa 100644 --- a/pangolin/scripts/pangolearn.smk +++ b/pangolin/scripts/pangolearn.smk @@ -18,8 +18,8 @@ if config.get("header_file"): ##### Utility functions ##### def expand_alias(pango_lineage, alias_dict): - if not pango_lineage or pango_lineage == "": - return pango_lineage + if not pango_lineage or pango_lineage in ["None", None, ""] or "/" in pango_lineage: + return None lineage_parts = pango_lineage.split(".") if lineage_parts[0].startswith('X'): @@ -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 @@ -225,7 +225,7 @@ rule generate_report: 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 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 @@ -351,7 +351,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