Skip to content

Commit

Permalink
Merge pull request jeromekelleher#214 from jeromekelleher/remove-epi-isl
Browse files Browse the repository at this point in the history
Remove epi isl
  • Loading branch information
jeromekelleher authored Jul 31, 2024
2 parents 6e70114 + 0734f1b commit f4855f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion notebooks/qc-template.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
14 changes: 4 additions & 10 deletions sc2ts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,9 @@ 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.epi_isl_map = {}
self.strain_map = {}
self.recombinants = get_recombinants(ts)
self.nodes_max_descendant_samples = max_descendant_samples(ts)
Expand All @@ -348,10 +346,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"]
Expand Down Expand Up @@ -1036,11 +1030,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]
Expand Down Expand Up @@ -2021,6 +2013,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,
Expand Down

0 comments on commit f4855f2

Please sign in to comment.