diff --git a/workflow/scripts/plot-lineages-over-time.py b/workflow/scripts/plot-lineages-over-time.py index 164cfb89d..9dc933b7c 100644 --- a/workflow/scripts/plot-lineages-over-time.py +++ b/workflow/scripts/plot-lineages-over-time.py @@ -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) diff --git a/workflow/scripts/plot-variants-over-time.py b/workflow/scripts/plot-variants-over-time.py index 541575d2f..d03daed57 100644 --- a/workflow/scripts/plot-variants-over-time.py +++ b/workflow/scripts/plot-variants-over-time.py @@ -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)