Skip to content

Commit

Permalink
Corrected branch length/support precision in output
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericlemoine committed Mar 9, 2017
1 parent b2ced8f commit 2acdbff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tree/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ func (e *Edge) ToStatsString() string {
var err error
var length = "N/A"
if e.Length() != NIL_LENGTH {
length = fmt.Sprintf("%f", e.Length())
length = fmt.Sprintf("%g", e.Length())
}
var support = "N/A"
if e.Support() != NIL_SUPPORT {
support = fmt.Sprintf("%f", e.Support())
support = fmt.Sprintf("%g", e.Support())
}

var depth, leftdepth, rightdepth int
Expand All @@ -145,7 +145,7 @@ func (e *Edge) ToStatsString() string {

name := ""
if e.PValue() != NIL_PVALUE {
name = fmt.Sprintf("%f/%f", e.Support(), e.PValue())
name = fmt.Sprintf("%g/%g", e.Support(), e.PValue())
} else {
name = e.Right().Name()
}
Expand Down
6 changes: 3 additions & 3 deletions tree/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ func (n *Node) Newick(parent *Node, newick *bytes.Buffer) {
}
child.Newick(n, newick)
if n.br[i].support != NIL_SUPPORT && child.Name() == "" {
newick.WriteString(fmt.Sprintf("%f", n.br[i].support))
newick.WriteString(fmt.Sprintf("%g", n.br[i].support))
if n.br[i].pvalue != NIL_PVALUE {
newick.WriteString(fmt.Sprintf("/%f", n.br[i].pvalue))
newick.WriteString(fmt.Sprintf("/%g", n.br[i].pvalue))
}
}
if len(child.comment) != 0 {
Expand All @@ -177,7 +177,7 @@ func (n *Node) Newick(parent *Node, newick *bytes.Buffer) {
}
if n.br[i].length != NIL_LENGTH {
newick.WriteString(":")
newick.WriteString(fmt.Sprintf("%f", n.br[i].length))
newick.WriteString(fmt.Sprintf("%g", n.br[i].length))
}
nbchild++
}
Expand Down

0 comments on commit 2acdbff

Please sign in to comment.