Add the following two highlighted lines to main.cpp (after createTestTree()
):
#include <iostream>
#include "node.hpp"
#include "tree.hpp"
#include "tree_manip.hpp"
using namespace strom;
const double Node::_smallest_edge_length = 1.0e-12;
int main(int argc, const char * argv[]) {
std::cout << "Starting..." << std::endl;
TreeManip tm;
tm.createTestTree();
<span style="color:#0000ff"><strong>std::cout << tm.makeNewick(3) << std::endl;</strong></span>
<span style="color:#0000ff"><strong>std::cout << tm.makeNewick(3, true) << std::endl;</strong></span>
std::cout << "\nFinished!" << std::endl;
return 0;
}
The first of these lines will generate a newick tree description using numbers (because the default value of the makeNewick
parameter use_names
is false
), while the second one will generate a newick descriptions in which the names stored in each tip node are used.
In your browser, go to the Boost C++ home page, find the latest release (1.71.0 at this writing), and navigate to the Downloads page. Download the file boost_1_71_0.tar.gz or boost_1_71_0.zip and unpack in the directory of your choice. I will assume that you unpacked it at ~/Documents/libraries so that you now have a directory ~/Documents/libraries/boost_1_71_0.
Choose Xcode > Preferences… from the main menu, then choose the “Locations” tab, then click the “Custom Paths” subtab.
Click the +
button and add a new custom path item named BOOST_ROOT
with display name BOOST_ROOT
. On my computer, I entered the path /Users/plewis/Documents/libraries/boost_1_71_0
(but you should of course modify this for your case).
Click the red button at the top left to close the preferences dialog box.
Click once on the strom project (with the blue project icon ) in the Project Navigator, then select the strom TARGET within the project settings shown in the central pane. You should now see General, Resource Tags, Build Settings, Build Phases, and Build Rules across the top of the central pane.
Click on Build Settings, All (not Basic or Customized), Levels (not Combined), and then type “Header Search Paths” into the Search box to filter out all build settings except the one we are interested in at the moment.
In the “Header Search Paths” row, double-click on the column with the blue project icon (this is the column for the project settings, the other column labeled strom contains target-specific settings).
Click the +
button at the bottom left corner and type $(BOOST_ROOT)
(this will expand to the custom path you defined earlier).
Go ahead and compile strom again. This time it should compile and install cleanly. You should see the following additional lines appear in the output when the program is run:
((1:0.100,2:0.100):0.100,3:0.200)
((first_leaf:0.100,second_leaf:0.100):0.100,third_leaf:0.200)
Note that 3 decimal places are used in outputting edge lengths because you supplied 3 as an argument to the makeNewick
function.