From a701e8c4e6ae8a4ff8febee34261e4fe49e9ecd6 Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Wed, 31 Jul 2024 09:42:03 +0100 Subject: [PATCH 1/2] Remove epi_isl_map from TreeInfo Closes #210 --- notebooks/qc-template.ipynb | 2 +- sc2ts/utils.py | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/notebooks/qc-template.ipynb b/notebooks/qc-template.ipynb index b549807..aa7ab5e 100644 --- a/notebooks/qc-template.ipynb +++ b/notebooks/qc-template.ipynb @@ -189,7 +189,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.6" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/sc2ts/utils.py b/sc2ts/utils.py index 0e4f4ce..ab4fbc5 100644 --- a/sc2ts/utils.py +++ b/sc2ts/utils.py @@ -323,7 +323,6 @@ def __init__(self, ts, show_progress=True, pango_source="Nextclade_pango"): # Can current set pango_source to "Nextclade_pango" or "GISAID_lineage" self.ts = ts self.pango_source = pango_source - self.epi_isl_map = {} self.strain_map = {} self.recombinants = get_recombinants(ts) self.nodes_max_descendant_samples = max_descendant_samples(ts) @@ -348,10 +347,6 @@ def __init__(self, ts, show_progress=True, pango_source="Nextclade_pango"): md = node.metadata self.nodes_metadata[node.id] = md if node.is_sample(): - self.epi_isl_map[md["gisaid_epi_isl"]] = node.id - if md["gisaid_epi_isl"] is not None: - if "." in md["gisaid_epi_isl"]: - self.epi_isl_map[md["gisaid_epi_isl"].split(".")[0]] = node.id self.strain_map[md["strain"]] = node.id self.nodes_date[node.id] = md["date"] self.nodes_submission_date[node.id] = md["date_submitted"] @@ -1036,11 +1031,9 @@ def _mutation_summary(self, mut_id): "metadata": self.ts.mutation(mut_id).metadata, } - def node_report(self, node_id=None, strain=None, epi_isl=None): + def node_report(self, node_id=None, strain=None): if strain is not None: node_id = self.strain_map[strain] - if epi_isl is not None: - node_id = self.epi_isl_map[epi_isl] # node_summary = pd.DataFrame([self._node_summary(node_id)]) # TODO improve this for internal nodes node_summary = [self.ts.node(node_id).metadata] @@ -2021,6 +2014,8 @@ def add_gisaid_lineages_to_ts(ts, node_gisaid_lineages, linmuts_dict): return edited_ts +# NOTE: this is broken since moving to Viridian metadata, we no longer have +# GISAID EPI ISL in the metadata def check_lineages( ts, ti, From 0734f1b73c9e0f452af27de0986422067dac4c42 Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Wed, 31 Jul 2024 09:45:45 +0100 Subject: [PATCH 2/2] Change default pango source to Viridian --- sc2ts/utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sc2ts/utils.py b/sc2ts/utils.py index ab4fbc5..0752ce9 100644 --- a/sc2ts/utils.py +++ b/sc2ts/utils.py @@ -319,8 +319,7 @@ def max_descendant_samples(ts, show_progress=True): class TreeInfo: - def __init__(self, ts, show_progress=True, pango_source="Nextclade_pango"): - # Can current set pango_source to "Nextclade_pango" or "GISAID_lineage" + def __init__(self, ts, show_progress=True, pango_source="Viridian_pangolin"): self.ts = ts self.pango_source = pango_source self.strain_map = {}