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
| // il y a un peu de code de DEMO au debut code:
$toto = '((((1:0.a1,2:a2)3:0.a3,((4:0.b1,5:0.b2)6:0.b3,(7:0.c1,8:0.c2)9:0.c3)10:0.bc3)11:0.abc3,(12:0.d1,13:0.d2):0.d3)14:0.abcd3,15:0.e2)';
//$toto ='(((((1:0.01,2:0.01):0.05,(5:0.02,19:0.02):0.04,alone:dist):0.05,(3:0.03,4:0.03):0.08):0.59,(7:0.13,20:0.13):0.57):0.14,6:0.84)tout:distance;';
$tree = new NewickParser($toto);
echo '';
print_r( $tmp = $tree->parse() );
print_r( $tree->formatFlat($tmp) );
print_r( $tree->formatLayered($tmp) );
print_r( $tree->formatRich($tmp));
file_put_contents(__FILE__.'.xml',$tree->formatXMLString($tmp));
print( $tree->formatNewick($tmp));
echo ''; |
Partager