Skip to content

Commit

Permalink
Added an option for filtering branches in roccurve command
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericlemoine committed Nov 29, 2016
1 parent 04a58a0 commit 111cd6b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/roccurve.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ var roccurveMinThr float64
var roccurveMaxThr float64
var roccurveStepThr float64
var roccurveOutFile string
var roccurvePvalue float64
var roccurveMinBrLen float64
var roccurveMaxBrLen float64

type roccurveOutStats struct {
found bool
length float64
support float64
pvalue float64
}

// roccurveCmd represents the roccurve command
Expand Down Expand Up @@ -90,6 +92,7 @@ As output, a tab delimited file with columns:
found := false
length := e.Length()
support := e.Support()
pvalue := e.PValue()
if !e.Right().Tip() {
for _, e2 := range truetree.Edges() {
if !e2.Right().Tip() && e.SameBipartition(e2) {
Expand All @@ -101,6 +104,7 @@ As output, a tab delimited file with columns:
found,
length,
support,
pvalue,
}
}

Expand All @@ -121,7 +125,7 @@ As output, a tab delimited file with columns:
for result := range statResults {
i := 0
for thr := float64(roccurveMinThr); thr <= float64(roccurveMaxThr); thr += roccurveStepThr {
if result.support >= thr {
if result.support >= thr && result.pvalue <= roccurvePvalue {
if result.found {
tp[i]++
} else {
Expand Down Expand Up @@ -162,6 +166,7 @@ func init() {
roccurveCmd.PersistentFlags().Float64VarP(&roccurveMaxThr, "max", "M", 1, "Max threshold")
roccurveCmd.PersistentFlags().Float64VarP(&roccurveStepThr, "step", "s", 0.1, "Step between each threshold")
roccurveCmd.PersistentFlags().StringVarP(&roccurveOutFile, "out", "o", "stdout", "Output tree file, with supports")
roccurveCmd.PersistentFlags().Float64VarP(&roccurvePvalue, "pvalue", "p", 1.0, "Keep only branches that have a pvalue <= value")
roccurveCmd.PersistentFlags().Float64Var(&roccurveMaxBrLen, "length-leq", -1.0, "Keep only branches that are <= value (-1=No filter) ")
roccurveCmd.PersistentFlags().Float64Var(&roccurveMinBrLen, "length-geq", -1.0, "Keep only branches that are >= value (-1=No filter) ")
}

0 comments on commit 111cd6b

Please sign in to comment.