Skip to content

Commit

Permalink
profile: fix loging when using "--level strain" and no taxonomy given
Browse files Browse the repository at this point in the history
  • Loading branch information
shenwei356 committed Aug 15, 2022
1 parent 589958c commit d24fc6a
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 52 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- new flag `-f/--max-fpr`: maximal false positive rate of a query (default 0.05). It reduces outputting unnecessary when searching with a low minimal query coverage (-t/--min-query-cov).
- `profile`:
- recommend to use the flag `--no-amb-corr` to disable ambiguous reads correction when >= 1000 candidates are detected.
- fix loging when using `--level strain` and no taxonomy given.

### v0.8.2 - 2022-03-26

Expand Down
196 changes: 144 additions & 52 deletions kmcp/cmd/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -1070,10 +1070,17 @@ Examples:
if t.SumUniqMatch < 1 { // no enough unique match
hs = append(hs, h)
if debug {
fmt.Fprintf(outfhD, "failed1: %s (%s), 90th percentile: %.2f, %s: %.0f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough unique match", t.SumUniqMatch)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed1: %s (%s), 90th percentile: %.2f, %s: %.0f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough unique match", t.SumUniqMatch)
} else {
fmt.Fprintf(outfhD, "failed1: %s, 90th percentile: %.2f, %s: %.0f\n",
t.Name,
t.StatsA.Percentile(90),
"no enough unique match", t.SumUniqMatch)
}
}
continue
}
Expand All @@ -1084,10 +1091,18 @@ Examples:
if t.SumUniqMatchHic < 1 { // no enough high-confidence unique match
hs = append(hs, h)
if debug {
fmt.Fprintf(outfhD, "failed1: %s (%s), 90th percentile: %.2f, %s: %.0f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough high-confidence unique match", t.SumUniqMatchHic)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed1: %s (%s), 90th percentile: %.2f, %s: %.0f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough high-confidence unique match", t.SumUniqMatchHic)
} else {
fmt.Fprintf(outfhD, "failed1: %s, 90th percentile: %.2f, %s: %.0f\n",
t.Name,
t.StatsA.Percentile(90),
"no enough high-confidence unique match", t.SumUniqMatchHic)

}
}
continue
}
Expand All @@ -1111,10 +1126,17 @@ Examples:
if t.FragsProp < minFragsProp { // low coverage
hs = append(hs, h)
if debug {
fmt.Fprintf(outfhD, "failed1: %s (%s), 90th percentile: %.2f, %s: %.1f %v\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"low chunks fraction", t.FragsProp, t.Match)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed1: %s (%s), 90th percentile: %.2f, %s: %.1f %v\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"low chunks fraction", t.FragsProp, t.Match)
} else {
fmt.Fprintf(outfhD, "failed1: %s, 90th percentile: %.2f, %s: %.1f %v\n",
t.Name,
t.StatsA.Percentile(90),
"low chunks fraction", t.FragsProp, t.Match)
}
}
continue
}
Expand Down Expand Up @@ -1757,10 +1779,17 @@ Examples:
if t.SumUniqMatch < minUReads {
hs = append(hs, h)
if debug {
fmt.Fprintf(outfhD, "failed2: %s (%s), 90th percentile: %.2f, %s: %.0f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough unique match", t.SumUniqMatch)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed2: %s (%s), 90th percentile: %.2f, %s: %.0f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough unique match", t.SumUniqMatch)
} else {
fmt.Fprintf(outfhD, "failed2: %s, 90th percentile: %.2f, %s: %.0f\n",
t.Name,
t.StatsA.Percentile(90),
"no enough unique match", t.SumUniqMatch)
}
}
continue
}
Expand All @@ -1771,21 +1800,35 @@ Examples:
if t.SumUniqMatchHic < minHicUreads {
hs = append(hs, h)
if debug {
fmt.Fprintf(outfhD, "failed2: %s (%s), 90th percentile: %.2f, %s: %.0f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough high-confidence unique match", t.SumUniqMatchHic)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed2: %s (%s), 90th percentile: %.2f, %s: %.0f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough high-confidence unique match", t.SumUniqMatchHic)
} else {
fmt.Fprintf(outfhD, "failed2: %s, 90th percentile: %.2f, %s: %.0f\n",
t.Name,
t.StatsA.Percentile(90),
"no enough high-confidence unique match", t.SumUniqMatchHic)
}
}
continue
}

if t.SumUniqMatchHic < HicUreadsMinProp*t.SumUniqMatch {
hs = append(hs, h)
if debug {
fmt.Fprintf(outfhD, "failed2: %s (%s), 90th percentile: %.2f, %s: %.4f (%.0f/%.0f)\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough high-confidence unique match proportion", t.SumUniqMatchHic/t.SumUniqMatch, t.SumUniqMatchHic, t.SumUniqMatch)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed2: %s (%s), 90th percentile: %.2f, %s: %.4f (%.0f/%.0f)\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough high-confidence unique match proportion", t.SumUniqMatchHic/t.SumUniqMatch, t.SumUniqMatchHic, t.SumUniqMatch)
} else {
fmt.Fprintf(outfhD, "failed2: %s, 90th percentile: %.2f, %s: %.4f (%.0f/%.0f)\n",
t.Name,
t.StatsA.Percentile(90),
"no enough high-confidence unique match proportion", t.SumUniqMatchHic/t.SumUniqMatch, t.SumUniqMatchHic, t.SumUniqMatch)
}
}
continue
}
Expand All @@ -1802,10 +1845,17 @@ Examples:
if t.FragsProp < minFragsProp {
hs = append(hs, h)
if debug {
fmt.Fprintf(outfhD, "failed2: %s (%s), 90th percentile: %.2f, %s: %.1f %v\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"low chunks fraction", t.FragsProp, t.Match)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed2: %s (%s), 90th percentile: %.2f, %s: %.1f %v\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"low chunks fraction", t.FragsProp, t.Match)
} else {
fmt.Fprintf(outfhD, "failed2: %s, 90th percentile: %.2f, %s: %.1f %v\n",
t.Name,
t.StatsA.Percentile(90),
"low chunks fraction", t.FragsProp, t.Match)
}
}
continue
}
Expand All @@ -1822,10 +1872,17 @@ Examples:
if t.RelDepthStd > maxFragsDepthStdev {
hs = append(hs, h)
if debug {
fmt.Fprintf(outfhD, "failed2: %s (%s), 90th percentile: %.2f, %s: %f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"high FragsDepthStdev", t.RelDepthStd)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed2: %s (%s), 90th percentile: %.2f, %s: %f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"high FragsDepthStdev", t.RelDepthStd)
} else {
fmt.Fprintf(outfhD, "failed2: %s, 90th percentile: %.2f, %s: %f\n",
t.Name,
t.StatsA.Percentile(90),
"high FragsDepthStdev", t.RelDepthStd)
}
}
continue
}
Expand Down Expand Up @@ -2310,10 +2367,17 @@ Examples:
}
if t.SumUniqMatch < minUReads {
if debug {
fmt.Fprintf(outfhD, "failed3: %s (%s), 90th percentile: %.2f, %s: %.0f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough unique match", t.SumUniqMatch)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed3: %s (%s), 90th percentile: %.2f, %s: %.0f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough unique match", t.SumUniqMatch)
} else {
fmt.Fprintf(outfhD, "failed3: %s, 90th percentile: %.2f, %s: %.0f\n",
t.Name,
t.StatsA.Percentile(90),
"no enough unique match", t.SumUniqMatch)
}
}
continue
}
Expand All @@ -2323,20 +2387,34 @@ Examples:
}
if t.SumUniqMatchHic < minHicUreads {
if debug {
fmt.Fprintf(outfhD, "failed3: %s (%s), 90th percentile: %.2f, %s: %.0f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough high-confidence unique match", t.SumUniqMatchHic)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed3: %s (%s), 90th percentile: %.2f, %s: %.0f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough high-confidence unique match", t.SumUniqMatchHic)
} else {
fmt.Fprintf(outfhD, "failed3: %s, 90th percentile: %.2f, %s: %.0f\n",
t.Name,
t.StatsA.Percentile(90),
"no enough high-confidence unique match", t.SumUniqMatchHic)
}
}
continue
}

if t.SumUniqMatchHic < HicUreadsMinProp*t.SumUniqMatch {
if debug {
fmt.Fprintf(outfhD, "failed3: %s (%s), 90th percentile: %.2f, %s: %.4f (%.0f/%.0f)\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough high-confidence unique match proportion", t.SumUniqMatchHic/t.SumUniqMatch, t.SumUniqMatchHic, t.SumUniqMatch)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed3: %s (%s), 90th percentile: %.2f, %s: %.4f (%.0f/%.0f)\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"no enough high-confidence unique match proportion", t.SumUniqMatchHic/t.SumUniqMatch, t.SumUniqMatchHic, t.SumUniqMatch)
} else {
fmt.Fprintf(outfhD, "failed3: %s, 90th percentile: %.2f, %s: %.4f (%.0f/%.0f)\n",
t.Name,
t.StatsA.Percentile(90),
"no enough high-confidence unique match proportion", t.SumUniqMatchHic/t.SumUniqMatch, t.SumUniqMatchHic, t.SumUniqMatch)
}
}
continue
}
Expand All @@ -2352,10 +2430,17 @@ Examples:
t.FragsProp = t.FragsProp / float64(len(t.Match))
if t.FragsProp < minFragsProp {
if debug {
fmt.Fprintf(outfhD, "failed3: %s (%s), 90th percentile: %.2f, %s: %.1f %v\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"low chunks fraction", t.FragsProp, t.Match)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed3: %s (%s), 90th percentile: %.2f, %s: %.1f %v\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"low chunks fraction", t.FragsProp, t.Match)
} else {
fmt.Fprintf(outfhD, "failed3: %s 90th percentile: %.2f, %s: %.1f %v\n",
t.Name,
t.StatsA.Percentile(90),
"low chunks fraction", t.FragsProp, t.Match)
}
}
continue
}
Expand All @@ -2371,10 +2456,17 @@ Examples:
_, t.RelDepthStd = MeanStdev(t.RelDepth)
if t.RelDepthStd > maxFragsDepthStdev {
if debug {
fmt.Fprintf(outfhD, "failed3: %s (%s), 90th percentile: %.2f, %s: %f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"high FragsDepthStdev", t.RelDepthStd)
if taxdb != nil {
fmt.Fprintf(outfhD, "failed3: %s (%s), 90th percentile: %.2f, %s: %f\n",
t.Name, taxdb.Name(taxidMap[t.Name]),
t.StatsA.Percentile(90),
"high FragsDepthStdev", t.RelDepthStd)
} else {
fmt.Fprintf(outfhD, "failed3: %s, 90th percentile: %.2f, %s: %f\n",
t.Name,
t.StatsA.Percentile(90),
"high FragsDepthStdev", t.RelDepthStd)
}
}
continue
}
Expand Down

0 comments on commit d24fc6a

Please sign in to comment.