Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove max_count/max_lineage 'voting' logic from usher_parsing #521

Merged
merged 1 commit into from
May 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions pangolin/utils/report_collation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,16 @@ def usher_parsing(usher_result,output_report):
histo_list = [ i for i in histogram.split(",") if i ]
conflict = 0.0
if len(histo_list) > 1:
max_count = 0
max_lineage = ""
selected_count = 0
total = 0
for lin_counts in histo_list:
m = re.match('([A-Z0-9.]+)\(([0-9]+)/([0-9]+)\)', lin_counts)
if m:
lin, place_count, total = [m.group(1), int(m.group(2)), int(m.group(3))]
if place_count > max_count:
max_count = place_count
max_lineage = lin
if lin == lineage:
selected_count = place_count
if selected_count < max_count:
# The selected placement was not in the lineage with the plurality
# of placements; go with the plurality.
lineage = max_lineage
conflict = (total - max_count) / total
elif total > 0:
conflict = (total - selected_count) / total
break
conflict = (total - selected_count) / total
histogram_note = "Usher placements: " + " ".join(histo_list)
else:
lineage = lineage_histogram
Expand Down