Skip to content

Commit

Permalink
Modified shuffletips command to take several trees as input
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericlemoine committed Dec 8, 2016
1 parent 2627421 commit d9c2947
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions cmd/shuffletips.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ gotree shuffletips -i t.nw

rand.Seed(shuffletipsSeed)

var t *tree.Tree
var err error
t, err = utils.ReadRefTree(shuffleTipsInputTree)
if err != nil {
io.ExitWithMessage(err)
}
var nbtrees int

compareChannel := make(chan tree.Trees, 15)

go func() {
if nbtrees, err = utils.ReadCompTrees(shuffleTipsInputTree, compareChannel); err != nil {
io.ExitWithMessage(err)
}
}()

var f *os.File
if shuffleTipsOutputTree != "stdout" {
f, err = os.Create(shuffleTipsOutputTree)
Expand All @@ -53,13 +58,11 @@ gotree shuffletips -i t.nw
io.ExitWithMessage(err)
}

t.ShuffleTips()
for t2 := range compareChannel {

if err != nil {
io.ExitWithMessage(err)
t2.Tree.ShuffleTips()
f.WriteString(t2.Tree.Newick() + "\n")
}

f.WriteString(t.Newick() + "\n")
f.Close()
},
}
Expand Down

0 comments on commit d9c2947

Please sign in to comment.