Add comparator based on Needleman-Wunsch score
[autophylo.git] / tree_render.sh
blobe91fe9079ac70a8f095169584827357c7975b299
1 #!/bin/sh
2 # Take a tree described by weighted edges (on stdin), producing
3 # a png render (on stdout). Uses a text file taken as a parameter
4 # for labelling the nodes.
6 cat |
7 perl -nle 'BEGIN {
8 print "graph philo {";
9 our @l;
10 open my $f, "'"$1"'" or die "$!";
11 while (<$f>) { chomp; push @l, $_; print "$#l [label=\"$_\"]"; }
12 close $f;
14 chomp; my ($w, $a, $b) = split / /;
15 printf "\"%d\" -- \"%d\" [w=%f, label=\"%.3f\"]\n", $a, $b, $w, $w;
16 END { print "}"; }' |
17 dot -Tpng