-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: Add 'add_leaf' and 'remove_leaf' methods #38
Conversation
@ayushnag I've fixed the bugs to add leaf method. looks like now there's a merge conflict. Could you please resolve this? Thanks! |
@ayushnag I went ahead and fixed the merge conflicts, now the only thing failing is the remove_leaf, which I think need to be updated. |
@ayushnag Thanks for the initial codebase, I was able to quickly update the code and make it work. 😄 I think this is good now. |
Thanks @lsetiawan! |
This pull request introduces several new features and improvements to the
TreeVec
struct in thephylo2vec
library. The changes include new methods for manipulating the tree structure, additional documentation, and new tests to ensure functionality.Enhancements to
TreeVec
struct:phylo2vec/src/tree_vec/mod.rs
: Added new methodsadd_leaf
,remove_leaf
, andfrom_sample
to theTreeVec
struct, allowing for dynamic manipulation of the tree structure.phylo2vec/src/tree_vec/mod.rs
: Implemented theto_newick
method to convert the tree to Newick format and updated theget_ancestry
method to return anAncestry
type.Documentation improvements:
phylo2vec/src/tree_vec/mod.rs
: Added detailed documentation for theTreeVec
struct and its methods, includingnew
,from_sample
,to_newick
,get_ancestry
,add_leaf
, andremove_leaf
. [1] [2]Test additions:
phylo2vec/src/tree_vec/mod.rs
: Added new tests for creating trees from samples, converting trees to Newick format, retrieving ancestry matrices, and adding/removing leaves from the tree. [1] [2] [3] [4]Utility functions:
phylo2vec/src/tree_vec/ops/vector.rs
: Added utility functionsfind_coords_of_first_leaf
,order_cherries
,order_cherries_no_parents
, andbuild_vector
to support the newTreeVec
methods.Code refactoring:
phylo2vec/src/tree_vec/ops/vector.rs
: Refactored theget_ancestry
function to useusize::MAX
instead of-1
for uninitialized parent values, improving type safety and clarity.These changes collectively enhance the functionality, documentation, and test coverage of the
TreeVec
struct, making the library more robust and easier to use.TODOs
Related Issues