-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathheaderonlydecenttree.cpp
56 lines (48 loc) · 4.4 KB
/
headeronlydecenttree.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//If you want to use Open MP, on Windows, you will need to ensure that
//the (64-bit) version of libiomp5md.dll can be found in the library path
//when your executable runs.
#define USE_GZSTREAM 0 //If you linked in gzstream.cpp, this could be set to 1.
//(not that this example needs gz formatting)
#define USE_PROGRESS_DISPLAY 0 //If you linked in progress.cpp, this could be set to 1.
//to get progress bars (not much point on small inputs!)
#define USE_VECTORCLASS_LIBRARY 0 //For an input this small, vectorisation doesn't matter.
#define DECENT_TREE 1 //Otherwise
#include "distancematrix.h" //for loadDistanceMatrixFromOpenFile
#include "rapidnj.h" //for RapidNJ
#include <sstream> //for std::istringstream
void example_1() {
#if USE_VECTORCLASS_LIBRARY
StartTree::VectorNJ r;
#else
StartTree::RapidNJ r;
#endif
const char* input_string =
"17\n"
"LngfishAu 0.0000000 0.4394262 0.4253346 0.4739334 0.6469595 0.8072464 0.7697307 0.7867055 0.7850803 0.6959920 0.6336127 0.6997504 0.6793033 0.7120045 0.7344446 0.7318557 0.6820929\n"
"LngfishSA 0.4394262 0.0000000 0.3370420 0.6028511 0.7361390 0.8116547 0.7978951 0.7651678 0.6988087 0.7598439 0.7003997 0.7643007 0.7378452 0.7195253 0.8065221 0.7439359 0.6178323\n"
"LngfishAf 0.4253346 0.3370420 0.0000000 0.5921847 0.7020407 0.8573580 0.9137406 0.8639154 0.7878422 0.8294442 0.7505365 0.7882964 0.7551778 0.7706974 0.8561868 0.7818997 0.6850401\n"
"Frog 0.4739334 0.6028511 0.5921847 0.0000000 0.6268957 0.8150864 0.7705955 0.8145647 0.7573321 0.7166360 0.6626602 0.6762896 0.6809187 0.7005612 0.7136883 0.6974592 0.6449470\n"
"Turtle 0.6469595 0.7361390 0.7020407 0.6268957 0.0000000 0.5416702 0.5841215 0.5399763 0.4849490 0.5861821 0.5383720 0.5458270 0.5612534 0.5632785 0.6088667 0.5946969 0.5778748\n"
"Sphenodon 0.8072464 0.8116547 0.8573580 0.8150864 0.5416702 0.0000000 0.6723304 0.6249144 0.5897511 0.6946471 0.6787380 0.6565584 0.6772154 0.6833316 0.7476896 0.7240949 0.6518428\n"
"Lizard 0.7697307 0.7978951 0.9137406 0.7705955 0.5841215 0.6723304 0.0000000 0.7160903 0.6480652 0.7386573 0.7042574 0.7513723 0.7675040 0.6849374 0.7926459 0.7473559 0.6709445\n"
"Crocodile 0.7867055 0.7651678 0.8639154 0.8145647 0.5399763 0.6249144 0.7160903 0.0000000 0.4906657 0.7432287 0.7493887 0.7488493 0.8057593 0.8317762 0.8413625 0.7521970 0.7769550\n"
"Bird 0.7850803 0.6988087 0.7878422 0.7573321 0.4849490 0.5897511 0.6480652 0.4906657 0.0000000 0.6755495 0.6691967 0.6860033 0.6905877 0.7565543 0.7504430 0.6842440 0.6705485\n"
"Human 0.6959920 0.7598439 0.8294442 0.7166360 0.5861821 0.6946471 0.7386573 0.7432287 0.6755495 0.0000000 0.2750272 0.2814737 0.2961226 0.3590137 0.3757584 0.4477864 0.4220981\n"
"Seal 0.6336127 0.7003997 0.7505365 0.6626602 0.5383720 0.6787380 0.7042574 0.7493887 0.6691967 0.2750272 0.0000000 0.1931946 0.2118470 0.2817599 0.3180795 0.3787176 0.3496224\n"
"Cow 0.6997504 0.7643007 0.7882964 0.6762896 0.5458270 0.6565584 0.7513723 0.7488493 0.6860033 0.2814737 0.1931946 0.0000000 0.1754464 0.3199376 0.3320971 0.4013694 0.3449257\n"
"Whale 0.6793033 0.7378452 0.7551778 0.6809187 0.5612534 0.6772154 0.7675040 0.8057593 0.6905877 0.2961226 0.2118470 0.1754464 0.0000000 0.3251485 0.3558385 0.3925798 0.3595924\n"
"Mouse 0.7120045 0.7195253 0.7706974 0.7005612 0.5632785 0.6833316 0.6849374 0.8317762 0.7565543 0.3590137 0.2817599 0.3199376 0.3251485 0.0000000 0.1447365 0.4099219 0.3487804\n"
"Rat 0.7344446 0.8065221 0.8561868 0.7136883 0.6088667 0.7476896 0.7926459 0.8413625 0.7504430 0.3757584 0.3180795 0.3320971 0.3558385 0.1447365 0.0000000 0.4419960 0.4050277\n"
"Platypus 0.7318557 0.7439359 0.7818997 0.6974592 0.5946969 0.7240949 0.7473559 0.7521970 0.6842440 0.4477864 0.3787176 0.4013694 0.3925798 0.4099219 0.4419960 0.0000000 0.3202751\n"
"Opossum 0.6820929 0.6178323 0.6850401 0.6449470 0.5778748 0.6518428 0.6709445 0.7769550 0.6705485 0.4220981 0.3496224 0.3449257 0.3595924 0.3487804 0.4050277 0.3202751 0.0000000\n";
std::istringstream input_file(input_string);
loadDistanceMatrixFromOpenFile(input_file, false, r);
r.constructTree();
int precision = 6;
std::string newickTreeFilePath = "STDOUT";
r.writeTreeFile(precision, newickTreeFilePath);
}
int main(int argc, char* argv[]) {
example_1();
return 0;
}