Skip to content

Commit

Permalink
Merge pull request #462 from AngieHinrichs/usher_scorpio_no_override
Browse files Browse the repository at this point in the history
usher mode: run scorpio, report conflicts, but don't override usher assignment
  • Loading branch information
aineniamh authored Jun 15, 2022
2 parents 5071a18 + 4b9dc82 commit af00d8f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions pangolin/scripts/preprocessing.smk
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ rule scorpio:
log:
os.path.join(config[KEY_TEMPDIR], "logs/scorpio.log")
run:
if params.skip_scorpio or config[KEY_ANALYSIS_MODE] == "usher":
if params.skip_scorpio:
shell("touch {output.report:q}")
else:
shell("scorpio classify \
Expand All @@ -106,7 +106,7 @@ rule get_constellations:
output:
list = os.path.join(config[KEY_TEMPDIR], "get_constellations.txt")
run:
if params.skip_scorpio or config[KEY_ANALYSIS_MODE] == "usher":
if params.skip_scorpio:
shell("touch {output.list:q}")
else:
shell("scorpio list \
Expand Down
28 changes: 19 additions & 9 deletions pangolin/utils/report_collation.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,25 @@ def generate_final_report(preprocessing_csv, inference_csv, cached_csv, alias_fi
if expanded_scorpio_lineage and \
not expanded_pango_lineage.startswith(expanded_scorpio_lineage) and \
not (expanded_pango_lineage.startswith("X") and expanded_scorpio_lineage in recombinant_parents):
append_note(new_row, f'scorpio replaced lineage inference {inference_lineage}')
new_row["lineage"] = scorpio_lineage
if analysis_mode == "usher":
append_note(new_row, f'scorpio lineage {scorpio_lineage} conflicts with inference lineage {inference_lineage}')
else:
append_note(new_row, f'scorpio replaced lineage inference {inference_lineage}')
new_row["lineage"] = scorpio_lineage

elif row["scorpio_incompatible_lineages"] and inference_lineage in row["scorpio_incompatible_lineages"].split("|"):
append_note(new_row, f'scorpio replaced lineage inference {inference_lineage}')
new_row["lineage"] = scorpio_lineage
if analysis_mode == "usher":
append_note(new_row, f'scorpio lineage {scorpio_lineage} conflicts with inference lineage {inference_lineage} (incompatible)')
else:
append_note(new_row, f'scorpio replaced lineage inference {inference_lineage}')
new_row["lineage"] = scorpio_lineage

elif not expanded_scorpio_lineage:
append_note(new_row, f'scorpio replaced lineage inference {inference_lineage}')
new_row['lineage'] = UNASSIGNED_LINEAGE_REPORTED
if analysis_mode == "usher":
append_note(new_row, f'scorpio found insufficient support to assign a specific lineage')
else:
append_note(new_row, f'scorpio replaced lineage inference {inference_lineage}')
new_row['lineage'] = UNASSIGNED_LINEAGE_REPORTED

#3. check if lineage is a voc
elif row["lineage"] in voc_list:
Expand All @@ -265,9 +274,10 @@ def generate_final_report(preprocessing_csv, inference_csv, cached_csv, alias_fi
if expanded_pango_lineage.startswith(voc + ".") or expanded_pango_lineage == voc:
# have no scorpio call but an inference voc/vui call
append_note(new_row, f'Lineage inference {inference_lineage} was not supported by scorpio')
new_row['lineage'] = UNASSIGNED_LINEAGE_REPORTED
new_row['conflict'] = ""
new_row['ambiguity_score'] = ""
if analysis_mode != "usher":
new_row['lineage'] = UNASSIGNED_LINEAGE_REPORTED
new_row['conflict'] = ""
new_row['ambiguity_score'] = ""
break

if new_row['lineage'] == UNASSIGNED_LINEAGE_REPORTED:
Expand Down

0 comments on commit af00d8f

Please sign in to comment.