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

Ancestor span heatmap #62

Closed

Conversation

savitakartik
Copy link
Collaborator

@savitakartik savitakartik commented Aug 23, 2023

Partial fix for issue #20

This is a naive attempt at making a heatmap of average ancestor spans in time and position bins. I'm using nested for-loops to iterate over x and y axis bins and filtering values in the edges df.

Perhaps a quicker way to track genomic coordinates for the node spans is to either (a) modify child_bounds to return all edge_left and edge_right for a child or (b) assume the node persists in all trees between child_right and child_left .

@savitakartik
Copy link
Collaborator Author

ancestor_span_heatmap.mp4

@savitakartik
Copy link
Collaborator Author

savitakartik commented Aug 24, 2023

We've decided to assume contiguous ancestor nodes for now, as this doesn't happen very often, at least in inferred trees. It could be slightly miselading for simulated genomes, but we can state our assumption.

We can then calculate the plotting data by using an array for the heatmap bins, looping over the nodes, getting the bounds from the existing child_bounds method referenced in an above comment, and incrementing all bins that fall within these bounds and time by 1. Should be feasible with numpy and can Numba-fy if needed.

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

Successfully merging this pull request may close these issues.

1 participant