Skip to content

Phylo2Vec: a vector representation for binary trees (stripped-down version in C++)

License

Notifications You must be signed in to change notification settings

Neclow/phylo2vec_cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phylo2Vec: a vector representation for binary trees

Installation

Prerequisites:

  • C++14
  • GoogleTest 1.11.0: sudo apt-get install libgtest-dev
  • clang-format: sudo apt install clang-format
  • cmake 3.22.1: sudo apt-get install cmake
  • cxxopts 3.1.1:
    git clone https://github.com/jarro2783/cxxopts.git
    cd cxxopts
    mkdir build
    cd build
    cmake ..
    make
    sudo make install
    

Compile and build from scratch:

mkdir build
cd build
cmake ..
make

Or use the executable. To get information about all arguments:

./phylo2vec -h

Arguments:

  -h, --help            Show help
      --toNewick arg    Convert to Newick format. Example input: 0 1 4
      --toVector arg    Convert to integer vector. Example input:
                        "(((2,1)4,0)5,3)6;"
      --with_mapping    For Newicks that do not only contain digits, to use with toVector. Example input: "(((((((tip_0:1.44,tip_1:1.44)8042:0.46,(tip_2:1.5,tip_3:1.5)8043:0.4)8044:0.3,(tip_4:1.51,tip_5:1.51)8045:0.69)8046:0.4,tip_6:2.6)8047:1.05,tip_7:3.65)8048:0.5,(((tip_8:0.72,tip_9:0.72)8049:0.28,tip_10:1)8050:1.56,tip_11:2.56)8051:1.59)8052:1.96,tip_12:6.11)8053:0;"
      --num_leaves arg  Number of leaves (optional, but recommended when
                        using toVector)

Example usage of toNewick:

phylo2vec --toNewick 0 1 4

Example usage of toVector:

phylo2vec --toVector "(((2,1)4,0)5,3)6;" --num_leaves 4

Example usage of toVector:

./phylo2vec --with_mapping --toVector "(((((((tip_0:1.44,tip_1:1.44)8042:0.46,(tip_2:1.5,tip_3:1.5)8043:0.4)8044:0.3,(tip_4:1.51,tip_5:1.51)8045:0.69)8046:0.4,tip_6:2.6)8047:1.05,tip_7:3.65)8048:0.5,(((tip_8:0.72,tip_9:0.72)8049:0.28,tip_10:1)8050:1.56,tip_11:2.56)8051:1.59)8052:1.96,tip_12:6.11)8053:0;"

Python version:

Citation and other work

Note

  • At least half of this repo was coded on a Samsung A40 using JDoodle, that should probably deserve a star :)

About

Phylo2Vec: a vector representation for binary trees (stripped-down version in C++)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published