Skip to content

Commit

Permalink
Go 1.10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericlemoine committed Jul 27, 2018
1 parent 57c1861 commit 0ee8994
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,7 +1,7 @@
language: go

go:
- 1.9.2
- 1.10.3

install:
- go get -u github.com/golang/dep/cmd/dep
2 changes: 1 addition & 1 deletion acr/parsimony.go
Expand Up @@ -92,7 +92,7 @@ func parsimonyUPPASS(cur, prev *tree.Node, tipCharacters map[string]string, stat
if ok {
states[cur.Id()][stateindex] = 1
} else {
return errors.New(fmt.Sprintf("State %c does not exist in the alphabet, ignoring the state", state))
return errors.New(fmt.Sprintf("State %s does not exist in the alphabet, ignoring the state", state))
}
} else {
for _, child := range cur.Neigh() {
Expand Down
2 changes: 1 addition & 1 deletion io/nexus/nexus_parser.go
Expand Up @@ -199,7 +199,7 @@ func (p *Parser) Parse() (*Nexus, error) {
tips := t.Tips()
for _, tip := range tips {
if _, ok := taxlabels[tip.Name()]; !ok {
return nil, fmt.Errorf("Taxa name %s in the tree %d is not defined in the TAXLABELS block", i, tip.Name())
return nil, fmt.Errorf("Taxa name %s in the tree %d is not defined in the TAXLABELS block", tip.Name(), i)
}
}
if len(tips) != len(taxlabels) {
Expand Down
64 changes: 32 additions & 32 deletions tests/algo_test.go
Expand Up @@ -25,24 +25,24 @@ func TestLeastCommonAncestorUnrooted(t *testing.T) {
t.Error(err)
}
if n == nil {
t.Error("No common ancestor found")
t.Errorf("No common ancestor found")
}
if e == nil || len(e) == 0 {
t.Error("No common ancestor Edges found")
t.Errorf("No common ancestor Edges found")
}
if !mono {
t.Error("The group should be monophyletic")
t.Errorf("The group should be monophyletic")
}
if len(e) != 2 {
t.Error("Edge Length should be 2 and is %d", len(e))
t.Errorf("Edge Length should be 2 and is %d", len(e))
}

for _, ed := range e {
if ed.Right().Name() != "4" &&
ed.Right().Name() != "3" &&
ed.Left().Name() != "4" &&
ed.Left().Name() != "3" {
t.Error("Ancestor of wrong tips found")
t.Errorf("Ancestor of wrong tips found")
}
}

Expand All @@ -52,17 +52,17 @@ func TestLeastCommonAncestorUnrooted(t *testing.T) {
}

if n == nil {
t.Error("No common ancestor found")
t.Errorf("No common ancestor found")
}
if e == nil || len(e) == 0 {
t.Error("No common ancestor Edges found")
t.Errorf("No common ancestor Edges found")
}
if mono {
t.Error("The group should not be monophyletic")
t.Errorf("The group should not be monophyletic")
}

if len(e) != 2 {
t.Error("Edge Length should be 2 and is %d", len(e))
t.Errorf("Edge Length should be 2 and is %d", len(e))
}

star, err2 := newick.NewParser(strings.NewReader(startree)).Parse()
Expand All @@ -75,17 +75,17 @@ func TestLeastCommonAncestorUnrooted(t *testing.T) {
}

if n == nil {
t.Error("No common ancestor found")
t.Errorf("No common ancestor found")
}
if e == nil || len(e) == 0 {
t.Error("No common ancestor Edges found")
t.Errorf("No common ancestor Edges found")
}

if len(e) != 4 {
t.Error("Edge Length should be 4 and is %d", len(e))
t.Errorf("Edge Length should be 4 and is %d", len(e))
}
if !mono {
t.Error("The group should be monophyletic")
t.Errorf("The group should be monophyletic")
}

}
Expand All @@ -101,17 +101,17 @@ func TestAddBipartition(t *testing.T) {
}

if n == nil {
t.Error("No common ancestor found")
t.Errorf("No common ancestor found")
}
if e == nil || len(e) == 0 {
t.Error("No common ancestor Edges found")
t.Errorf("No common ancestor Edges found")
}
if !mono {
t.Error("The group should be monophyletic")
t.Errorf("The group should be monophyletic")
}

if len(e) != 3 {
t.Error("Edge Length should be 3 and is %d", len(e))
t.Errorf("Edge Length should be 3 and is %d", len(e))
}
star.AddBipartition(n, e, 0.001, 0.9)
n, e, mono, err = star.LeastCommonAncestorUnrooted(nil, "4", "5")
Expand All @@ -120,17 +120,17 @@ func TestAddBipartition(t *testing.T) {
}

if n == nil {
t.Error("No common ancestor found")
t.Errorf("No common ancestor found")
}
if e == nil || len(e) == 0 {
t.Error("No common ancestor Edges found")
t.Errorf("No common ancestor Edges found")
}
if !mono {
t.Error("The group should be monophyletic")
t.Errorf("The group should be monophyletic")
}

if len(e) != 2 {
t.Error("Edge Length should be 2 and is %d", len(e))
t.Errorf("Edge Length should be 2 and is %d", len(e))
}
fmt.Fprintf(os.Stdout, "%s\n", star.Newick())
star.AddBipartition(n, e, 0.001, 0.9)
Expand All @@ -141,17 +141,17 @@ func TestAddBipartition(t *testing.T) {
}

if n == nil {
t.Error("No common ancestor found")
t.Errorf("No common ancestor found")
}
if e == nil || len(e) == 0 {
t.Error("No common ancestor Edges found")
t.Errorf("No common ancestor Edges found")
}
if !mono {
t.Error("The group should be monophyletic")
t.Errorf("The group should be monophyletic")
}

if len(e) != 2 {
t.Error("Edge Length should be 2 and is %d", len(e))
t.Errorf("Edge Length should be 2 and is %d", len(e))
}
fmt.Fprintf(os.Stdout, "%s\n", star.Newick())
}
Expand All @@ -177,7 +177,7 @@ func TestMaxLengthPath(t *testing.T) {
tip, ok := nodeindex.GetNode(name)
if !ok {
if err != nil {
t.Error(fmt.Sprintf("Tip %s not found in the tree", name))
t.Errorf("Tip %s not found in the tree", name)
}
}
e, l, err2 := tree.MaxLengthPath(tip, nil)
Expand All @@ -186,15 +186,15 @@ func TestMaxLengthPath(t *testing.T) {

}
if l != expmaxlen[i] {
t.Error(fmt.Sprintf("Maximum length from Tip %s should be %f and is %f", name, expmaxlen[i], l))
t.Errorf("Maximum length from Tip %s should be %f and is %f", name, expmaxlen[i], l)
}

if len(e) != expmaxpath[i] {
t.Error(fmt.Sprintf("Nb edges of the maximum length path from Tip %s should be %d and is %d", name, expmaxpath[i], len(e)))
t.Errorf("Nb edges of the maximum length path from Tip %s should be %d and is %d", name, expmaxpath[i], len(e))
}

if e[0].Right().Name() != expmaxtip[i] {
t.Error(fmt.Sprintf("Maximum length tip from tip %s should be %s and is %s", name, expmaxtip[i], e[0].Right().Name()))
t.Errorf("Maximum length tip from tip %s should be %s and is %s", name, expmaxtip[i], e[0].Right().Name())
}
}
tr.RerootMidPoint()
Expand All @@ -211,10 +211,10 @@ func TestRerootMidPoint(t *testing.T) {
for _, e := range tr.Root().Edges() {
if e.Right().Name() == "4" {
if e.Length() != 8.5 {
t.Error("Length of the edge from root to 4 should be 8.5")
t.Errorf("Length of the edge from root to 4 should be 8.5")
}
} else if e.Length() != 1.5 {
t.Error("Length of the edge from root to internal node should be 1.5")
t.Errorf("Length of the edge from root to internal node should be 1.5")
}
}
}
Expand All @@ -230,7 +230,7 @@ func TestRerootMidPoint2(t *testing.T) {
fmt.Println(tr.Newick())
for _, e := range tr.Root().Edges() {
if e.Length() != 3 && e.Length() != 1 {
t.Error(fmt.Sprintf("Length at root should be 1 or 3 but is %f", e.Length()))
t.Errorf("Length at root should be 1 or 3 but is %f", e.Length())
}
}
}
2 changes: 1 addition & 1 deletion tests/edgeindex_benchmark.go
Expand Up @@ -21,7 +21,7 @@ func BenchmarkEdgeIndex(b *testing.B) {

reftree, err := utils.ReadTree("data/benchmark_ref.nw.gz", utils.FORMAT_NEWICK)
if err != nil {
b.Error(err.Error)
b.Error(err.Error())
}

if treefile, treereader, err = utils.GetReader("data/benchmark_boot.nw.gz"); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions tests/edgeindex_test.go
Expand Up @@ -61,9 +61,9 @@ func TestEdgeIndex2(t *testing.T) {
if !ok {
t.Error(fmt.Sprintf("Edge not found in the index"))
} else if !e.Right().Tip() && val.Count != i {
t.Error(fmt.Sprintf("Non tip edge count must be == %d (actually %d)", i, val))
t.Errorf("Non tip edge count must be == %d (actually %d)", i, val.Count)
} else if e.Right().Tip() && val.Count != (nbtrees-1)*numLoops+i {
t.Error(fmt.Sprintf("Tip edge count must be == %d (actually %d)", (nbtrees-1)*numLoops+i, val))
t.Errorf("Tip edge count must be == %d (actually %d)", (nbtrees-1)*numLoops+i, val.Count)
}
}
}
Expand Down

0 comments on commit 0ee8994

Please sign in to comment.