From f34d01283bae546681af74945f88fdef41eeea1f Mon Sep 17 00:00:00 2001 From: Ann-Kathrin Brueggemann Date: Wed, 8 Dec 2021 10:18:46 +0100 Subject: [PATCH 1/4] Changed plots occurence threshold to relative --- workflow/scripts/plot-lineages-over-time.py | 5 +++-- workflow/scripts/plot-variants-over-time.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/workflow/scripts/plot-lineages-over-time.py b/workflow/scripts/plot-lineages-over-time.py index 164cfb89d..e52082918 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 + threshold = len(pangolin_calls)/10 pangolin_calls.loc[ - pangolin_calls["lineage_count"] < 10, "lineage" - ] = "other (< 10 occ.)" + pangolin_calls["lineage_count"] < threshold, "lineage" + ] = "other (< low 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..4e18ed87e 100644 --- a/workflow/scripts/plot-variants-over-time.py +++ b/workflow/scripts/plot-variants-over-time.py @@ -84,7 +84,8 @@ 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 (< low occ.)" calls.rename(columns={"alteration": "Alteration", "date": "Date"}, inplace=True) From 56988946e6f533a5b2245d785111010066f759e9 Mon Sep 17 00:00:00 2001 From: Ann-Kathrin Brueggemann Date: Wed, 8 Dec 2021 10:41:46 +0100 Subject: [PATCH 2/4] fmt --- workflow/scripts/plot-lineages-over-time.py | 2 +- workflow/scripts/plot-variants-over-time.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/workflow/scripts/plot-lineages-over-time.py b/workflow/scripts/plot-lineages-over-time.py index e52082918..d223261af 100644 --- a/workflow/scripts/plot-lineages-over-time.py +++ b/workflow/scripts/plot-lineages-over-time.py @@ -31,7 +31,7 @@ def plot_lineages_over_time(sm_input, sm_output, dates, sm_output_table): ].transform(lambda s: s.count()) # mask low occurrences - threshold = len(pangolin_calls)/10 + threshold = len(pangolin_calls) / 10 pangolin_calls.loc[ pangolin_calls["lineage_count"] < threshold, "lineage" ] = "other (< low occ.)" diff --git a/workflow/scripts/plot-variants-over-time.py b/workflow/scripts/plot-variants-over-time.py index 4e18ed87e..4cd48dea5 100644 --- a/workflow/scripts/plot-variants-over-time.py +++ b/workflow/scripts/plot-variants-over-time.py @@ -84,8 +84,10 @@ def plot_variants_over_time(sm_output, sm_output_table): ].transform(lambda s: s.count()) # mask low occurrences - threshold = len(calls)/10 - calls.loc[calls["total occurrence"] < threshold, "alteration"] = "other (< low occ.)" + threshold = len(calls) / 10 + calls.loc[ + calls["total occurrence"] < threshold, "alteration" + ] = "other (< low occ.)" calls.rename(columns={"alteration": "Alteration", "date": "Date"}, inplace=True) From 7ad1ecf5a171f75b2238f8215acd5e0c824d6a18 Mon Sep 17 00:00:00 2001 From: Ann-Kathrin Brueggemann Date: Wed, 8 Dec 2021 14:49:31 +0100 Subject: [PATCH 3/4] Name changed: number of occurences in plot --- workflow/scripts/plot-lineages-over-time.py | 2 +- workflow/scripts/plot-variants-over-time.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/scripts/plot-lineages-over-time.py b/workflow/scripts/plot-lineages-over-time.py index d223261af..b1f359e26 100644 --- a/workflow/scripts/plot-lineages-over-time.py +++ b/workflow/scripts/plot-lineages-over-time.py @@ -34,7 +34,7 @@ def plot_lineages_over_time(sm_input, sm_output, dates, sm_output_table): threshold = len(pangolin_calls) / 10 pangolin_calls.loc[ pangolin_calls["lineage_count"] < threshold, "lineage" - ] = "other (< low occ.)" + ] = "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 4cd48dea5..091bb26d3 100644 --- a/workflow/scripts/plot-variants-over-time.py +++ b/workflow/scripts/plot-variants-over-time.py @@ -87,7 +87,7 @@ def plot_variants_over_time(sm_output, sm_output_table): threshold = len(calls) / 10 calls.loc[ calls["total occurrence"] < threshold, "alteration" - ] = "other (< low occ.)" + ] = "other (<"+str(threshold)+" occ.)" calls.rename(columns={"alteration": "Alteration", "date": "Date"}, inplace=True) From 8d9ada289ec989ebbd85bd9afab7ca51633bdfca Mon Sep 17 00:00:00 2001 From: Ann-Kathrin Brueggemann Date: Wed, 8 Dec 2021 14:52:58 +0100 Subject: [PATCH 4/4] fmt --- workflow/scripts/plot-lineages-over-time.py | 6 +++--- workflow/scripts/plot-variants-over-time.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/workflow/scripts/plot-lineages-over-time.py b/workflow/scripts/plot-lineages-over-time.py index b1f359e26..9dc933b7c 100644 --- a/workflow/scripts/plot-lineages-over-time.py +++ b/workflow/scripts/plot-lineages-over-time.py @@ -32,9 +32,9 @@ def plot_lineages_over_time(sm_input, sm_output, dates, sm_output_table): # mask low occurrences threshold = len(pangolin_calls) / 10 - pangolin_calls.loc[ - pangolin_calls["lineage_count"] < threshold, "lineage" - ] = "other (<"+str(threshold)+" occ.)" + 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 091bb26d3..d03daed57 100644 --- a/workflow/scripts/plot-variants-over-time.py +++ b/workflow/scripts/plot-variants-over-time.py @@ -85,9 +85,9 @@ def plot_variants_over_time(sm_output, sm_output_table): # mask low occurrences threshold = len(calls) / 10 - calls.loc[ - calls["total occurrence"] < threshold, "alteration" - ] = "other (<"+str(threshold)+" occ.)" + calls.loc[calls["total occurrence"] < threshold, "alteration"] = ( + "other (<" + str(threshold) + " occ.)" + ) calls.rename(columns={"alteration": "Alteration", "date": "Date"}, inplace=True)