Skip to content

Commit

Permalink
No error but warning when a support value is given to root node
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericlemoine committed Apr 29, 2019
1 parent 10cd49f commit 0d8a93d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions io/newick/newick_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package newick
import (
"errors"
"fmt"
"github.com/evolbioinfo/gotree/tree"
"io"
"log"
"strconv"
"strings"

"github.com/evolbioinfo/gotree/tree"
)

// Parser represents a parser.
Expand Down Expand Up @@ -190,17 +192,19 @@ func (p *Parser) parseRecur(t *tree.Tree, node *tree.Node, level *int) (Token, e
// Bootstrap support value (numeric)
if tok == NUMERIC {
if *level == 0 {
return -1, errors.New("Newick Error: We do not accept support value on root")
}
e, err := newNode.ParentEdge()
if err != nil {
return -1, err
}
support, errf := strconv.ParseFloat(lit, 64)
if errf != nil {
return -1, err
log.Print("Newick : Support values attached to root node are ignored")
//return -1, errors.New("Newick Error: We do not accept support value on root")
} else {
e, err := newNode.ParentEdge()
if err != nil {
return -1, err
}
support, errf := strconv.ParseFloat(lit, 64)
if errf != nil {
return -1, err
}
e.SetSupport(support)
}
e.SetSupport(support)
} else {
// Node name
if newNode == nil {
Expand Down

0 comments on commit 0d8a93d

Please sign in to comment.