Skip to content

Commit

Permalink
fix: relative aggregation of samples for variants and lineages over t…
Browse files Browse the repository at this point in the history
…ime plots (#382)

* Changed plots occurence threshold to relative

* fmt

* Name changed: number of occurences in plot

* fmt

Co-authored-by: Thomas Battenfeld <[email protected]>
  • Loading branch information
AKBrueggemann and thomasbtf authored Dec 10, 2021
1 parent 23ed39e commit ebe556c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions workflow/scripts/plot-lineages-over-time.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ def plot_lineages_over_time(sm_input, sm_output, dates, sm_output_table):
].transform(lambda s: s.count())

# mask low occurrences
pangolin_calls.loc[
pangolin_calls["lineage_count"] < 10, "lineage"
] = "other (< 10 occ.)"
threshold = len(pangolin_calls) / 10
pangolin_calls.loc[pangolin_calls["lineage_count"] < threshold, "lineage"] = (
"other (<" + str(threshold) + " occ.)"
)

pangolin_calls.rename(columns={"lineage": "Lineage", "date": "Date"}, inplace=True)

Expand Down
5 changes: 4 additions & 1 deletion workflow/scripts/plot-variants-over-time.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ def plot_variants_over_time(sm_output, sm_output_table):
].transform(lambda s: s.count())

# mask low occurrences
calls.loc[calls["total occurrence"] < 10, "alteration"] = "other (< 10 occ.)"
threshold = len(calls) / 10
calls.loc[calls["total occurrence"] < threshold, "alteration"] = (
"other (<" + str(threshold) + " occ.)"
)

calls.rename(columns={"alteration": "Alteration", "date": "Date"}, inplace=True)

Expand Down

0 comments on commit ebe556c

Please sign in to comment.