Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace node report Markdown with Panel #437

Open
jeromekelleher opened this issue Dec 8, 2024 · 0 comments
Open

Replace node report Markdown with Panel #437

jeromekelleher opened this issue Dec 8, 2024 · 0 comments

Comments

@jeromekelleher
Copy link
Owner

Clunky report tool can be replace with panel very easily. Here's something that's most of the way there.

node = ti.pango_lineage_samples["B.1.1.7"][-1]
#node = 131223
closest_recombinant, df = ti._show_path_to_root(ti.ts.first(), node)
df_mut_path = ti.mutation_path(node)

child  = node
edge_list = [
            ts.edge(eid) for eid in np.where(ts.edges_child == child)[0]
        ]
edges = tskit.EdgeTable()
for e in sorted(edge_list, key=lambda e: e.left):
    edges.append(e)

html = ti._copying_table(node, edges)

pn.Accordion(
    ("Metadata",pn.pane.JSON(ti.nodes_metadata[node])),
    ("Copying path", pn.pane.HTML(html)),
    ("Path to root", pn.widgets.Tabulator(df)),
    ("Mutation path", pn.widgets.Tabulator(df_mut_path)),
    active=[0, 1],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant