Skip to content

Commit

Permalink
Merge pull request #249 from cov-lineages/patch
Browse files Browse the repository at this point in the history
Add robustness to scorpio overwrite for missing lineages and unusual constellation names
  • Loading branch information
rmcolq authored Jun 17, 2021
2 parents 27f4e24 + 367789a commit 7620ff0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions pangolin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
_program = "pangolin"
__version__ = "3.1.2"

__version__ = "3.1.3"

__all__ = ["pangolearn",
"utils"]
Expand Down
2 changes: 1 addition & 1 deletion pangolin/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 5 additions & 5 deletions pangolin/scripts/pangolearn.smk
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand All @@ -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


Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 7620ff0

Please sign in to comment.