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

Improve neighbour-joining tree performance #641

Merged
merged 12 commits into from
Oct 17, 2024

Conversation

alimanfoo
Copy link
Member

@alimanfoo alimanfoo commented Oct 15, 2024

  • Use anjl instead of biotite to build neighbour-joining trees, which is capable of building trees for 20,000+ samples in around 5 minutes. Resolves Neighbour-joining tree performance #627.
  • Cache the results of tree construction to avoid repeated computation.
  • Use anjl for tree plotting.
  • Also work towards Anopheles refactor #366.
  • Along the way, fix issues encountered when plotting and data includes missing values.

  • Create a new module malariagen_data.anoph.distance.
  • Add a class AnophelesDistanceAnalysis.
  • Move the public method biallelic_pairwise_distances() and associated private methods from the AnophelesDataResource class to the new AnophelesDistanceAnalysis class.
  • Add a public method njt() to the new class which returns an array Z and which also saves results to the results cache.
  • Add a private method _njt() which is called from within njt() to run the actual neighbour-joining if the result is not cached, calling biallelic_pairwise_distances() internally to obtain a distance matrix then anjl.rapid_nj() to compute a tree.
  • Add a public method plot_njt() to the new class which calls njt() first to obtain a tree then calls anjl.plot() to create a plot.
  • Remove the plot_njt() method from the AnophelesDataResource class.
  • Add AnophelesDistanceAnalysis as a parent class of AnophelesDataResource.
  • Add tests to get coverage of the new AnophelesDistanceAnalysis class.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@alimanfoo alimanfoo mentioned this pull request Oct 15, 2024
24 tasks
@alimanfoo alimanfoo requested a review from leehart October 15, 2024 23:09
Copy link
Collaborator

@leehart leehart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Thanks @alimanfoo 👍

@alimanfoo alimanfoo merged commit 319df58 into master Oct 17, 2024
10 checks passed
@alimanfoo alimanfoo deleted the njt-refactor-2024-10-15-alimanfoo branch October 17, 2024 22:10
@alimanfoo alimanfoo added the BMGF-068808 Work supported by BMGF grant INV-068808 (MalariaGEN 2024-2027). label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BMGF-068808 Work supported by BMGF grant INV-068808 (MalariaGEN 2024-2027).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Neighbour-joining tree performance
2 participants