diff --git a/cmd/compareedges.go b/cmd/compareedges.go index 03bcf3d..42f30d8 100644 --- a/cmd/compareedges.go +++ b/cmd/compareedges.go @@ -40,7 +40,7 @@ If the compared tree file contains several trees, it will take the first one onl edges1 := refTree.Edges() - fmt.Printf("tree\tbrid\tlength\tsupport\tterminal\tdepth\ttopodepth\trightname\tfound") + fmt.Printf("tree\tbrid\tlength\tsupport\tterminal\tdepth\ttopodepth\trootdepth\trightname\tfound") fmt.Printf("\ttransfer\ttaxatomove\tcomparednodename\tcomparedlength\tcomparedsupport\tcomparedtopodepth\tcomparedid") fmt.Printf("\n") diff --git a/cmd/edges.go b/cmd/edges.go index e74c606..06f6bd4 100644 --- a/cmd/edges.go +++ b/cmd/edges.go @@ -53,7 +53,7 @@ gotree stats edges -i t.nw } defer closeWriteFile(f, outtreefile) - f.WriteString("tree\tbrid\tlength\tsupport\tterminal\tdepth\ttopodepth\trightname\tcomments\tleftname\trightcomment\tleftcomment") + f.WriteString("tree\tbrid\tlength\tsupport\tterminal\tdepth\ttopodepth\trootdepth\trightname\tcomments\tleftname\trightcomment\tleftcomment") f.WriteString("\n") if treefile, treechan, err = readTrees(intreefile); err != nil { io.LogError(err) diff --git a/docs/commands/stats.md b/docs/commands/stats.md index 4c533c6..f5d47ff 100644 --- a/docs/commands/stats.md +++ b/docs/commands/stats.md @@ -90,25 +90,55 @@ Should give and -|tree | brid | length | support | terminal | depth | topodepth | rightname | -|------|--------|------------------------|-----------|------------|---------|-------------|-------------| -|0 | 0 | 0.0912341925030609 | N/A | false | 1 | 3 | | -|0 | 1 | 0.020616211789029896 | N/A | true | 0 | 1 | Tip4 | -|0 | 2 | 0.12939642466438622 | N/A | false | 1 | 2 | | -|0 | 3 | 0.09740195047110385 | N/A | true | 0 | 1 | Tip7 | -|0 | 4 | 0.015450672710905129 | N/A | true | 0 | 1 | Tip2 | -|0 | 5 | 0.12959932895259058 | N/A | true | 0 | 1 | Tip0 | -|0 | 6 | 0.022969404523534506 | N/A | false | 1 | 4 | | -|0 | 7 | 0.09604804621401375 | N/A | false | 1 | 3 | | -|0 | 8 | 0.027845992087631298 | N/A | true | 0 | 1 | Tip8 | -|0 | 9 | 0.005132906169455565 | N/A | false | 1 | 2 | | -|0 | 10 | 0.13492605122032592 | N/A | true | 0 | 1 | Tip9 | -|0 | 11 | 0.10309294031874587 | N/A | true | 0 | 1 | Tip3 | -|0 | 12 | 0.15075207292513051 | N/A | false | 1 | 3 | | -|0 | 13 | 0.029087690784364996 | N/A | false | 1 | 2 | | -|0 | 14 | 0.3779897840448691 | N/A | true | 0 | 1 | Tip6 | -|0 | 15 | 0.1120177846434196 | N/A | true | 0 | 1 | Tip5 | -|0 | 16 | 0.239082088939295 | N/A | true | 0 | 1 | Tip1 | +|tree | brid | length | support | terminal | depth | topodepth | rootdepth | rightname | +|------|--------|------------------------|-----------|------------|---------|-------------|-------------|-------------| +|0 | 0 | 0.0912341925030609 | N/A | false | 1 | 3 | -1 | | +|0 | 1 | 0.020616211789029896 | N/A | true | 0 | 1 | -1 | Tip4 | +|0 | 2 | 0.12939642466438622 | N/A | false | 1 | 2 | -1 | | +|0 | 3 | 0.09740195047110385 | N/A | true | 0 | 1 | -1 | Tip7 | +|0 | 4 | 0.015450672710905129 | N/A | true | 0 | 1 | -1 | Tip2 | +|0 | 5 | 0.12959932895259058 | N/A | true | 0 | 1 | -1 | Tip0 | +|0 | 6 | 0.022969404523534506 | N/A | false | 1 | 4 | -1 | | +|0 | 7 | 0.09604804621401375 | N/A | false | 1 | 3 | -1 | | +|0 | 8 | 0.027845992087631298 | N/A | true | 0 | 1 | -1 | Tip8 | +|0 | 9 | 0.005132906169455565 | N/A | false | 1 | 2 | -1 | | +|0 | 10 | 0.13492605122032592 | N/A | true | 0 | 1 | -1 | Tip9 | +|0 | 11 | 0.10309294031874587 | N/A | true | 0 | 1 | -1 | Tip3 | +|0 | 12 | 0.15075207292513051 | N/A | false | 1 | 3 | -1 | | +|0 | 13 | 0.029087690784364996 | N/A | false | 1 | 2 | -1 | | +|0 | 14 | 0.3779897840448691 | N/A | true | 0 | 1 | -1 | Tip6 | +|0 | 15 | 0.1120177846434196 | N/A | true | 0 | 1 | -1 | Tip5 | +|0 | 16 | 0.239082088939295 | N/A | true | 0 | 1 | -1 | Tip1 | + +As the tree is unrooted, `rootdepth` is set to -1. However, with a rooted tree: + +``` +gotree generate yuletree -r --seed 10 | gotree stats edges +``` + +|tree | brid | length | support | terminal | depth | topodepth | rootdepth | rightname | comments | leftname | rightcomment | leftcomment | +|-----|------|-----------------------|---------|----------|-------|-----------|-----------|-----------|----------|----------|--------------|-------------| +|0 | 0 | 0.054743875470795914 | N/A | false | 2 | 2 | 1 | | [] | | [] | [] | +|0 | 1 | 0.13492605122032592 | N/A | false | 1 | 2 | 2 | | [] | | [] | [] | +|0 | 2 | 0.10309294031874587 | N/A | true | 0 | 1 | 3 | Tip9 | [] | | [] | [] | +|0 | 3 | 0.03707446096764306 | N/A | true | 0 | 1 | 3 | Tip2 | [] | | [] | [] | +|0 | 4 | 0.13604994737755394 | N/A | false | 1 | 4 | 2 | | [] | | [] | [] | +|0 | 5 | 0.19852695409349608 | N/A | true | 0 | 1 | 3 | Tip3 | [] | | [] | [] | +|0 | 6 | 0.020616211789029896 | N/A | false | 1 | 5 | 3 | | [] | | [] | [] | +|0 | 7 | 0.08184535681853511 | N/A | false | 1 | 4 | 4 | | [] | | [] | [] | +|0 | 8 | 0.3779897840448691 | N/A | false | 1 | 3 | 5 | | [] | | [] | [] | +|0 | 9 | 0.027845992087631298 | N/A | false | 1 | 2 | 6 | | [] | | [] | [] | +|0 | 10 | 0.0440885662122905 | N/A | true | 0 | 1 | 7 | Tip8 | [] | | [] | [] | +|0 | 11 | 0.14809735366802398 | N/A | true | 0 | 1 | 7 | Tip6 | [] | | [] | [] | +|0 | 12 | 0.18347097513974125 | N/A | true | 0 | 1 | 6 | Tip5 | [] | | [] | [] | +|0 | 13 | 0.03199874235185574 | N/A | true | 0 | 1 | 5 | Tip4 | [] | | [] | [] | +|0 | 14 | 0.10033210749794116 | N/A | true | 0 | 1 | 4 | Tip1 | [] | | [] | [] | +|0 | 15 | 0.09740195047110385 | N/A | false | 1 | 2 | 1 | | [] | | [] | [] | +|0 | 16 | 0.015450672710905129 | N/A | true | 0 | 1 | 2 | Tip7 | [] | | [] | [] | +|0 | 17 | 0.17182241382980687 | N/A | true | 0 | 1 | 2 | Tip0 | [] | | [] | [] | + + +Here `rootdepth` gives the number of branches from the current branch (included) to the root. * Check wether a set of tips form a monophyletic clade diff --git a/test.sh b/test.sh index 68f7344..205d8db 100755 --- a/test.sh +++ b/test.sh @@ -316,24 +316,24 @@ rm -f expected result # gotree compare edges echo "->gotree compare edges" cat > expected < result 2>/dev/null diff -q -b expected result @@ -343,24 +343,24 @@ rm -f expected result # gotree compare edges echo "->gotree compare edges /2 (same tree)" cat > expected < result 2>/dev/null diff -q -b expected result @@ -835,29 +835,44 @@ rm -f expected expected2 result echo "->gotree stats edges" cat > expected < result diff -q -b expected result rm -f expected result +echo "->gotree stats edges /2 rooted" +cat > expected < result +diff -q -b expected result +rm -f expected result echo "->gotree stats nodes" cat > expected <