Repository navigation
Address PR #232 app comments: asymmetric placement tolerance + import cleanup (rebased onto 688d16a) #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Address PR #232 app comments: asymmetric placement tolerance + import cleanup (rebased onto 688d16a) #236
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,11 +28,15 @@ const DEFAULT_TAXONOMIC_RANKS = [ | |
| "Class", "Order", "Family", "Genus", "Species", | ||
| ] | ||
|
|
||
| # Multi-candidate placements partition probability mass across kept edges and | ||
| # must sum to 1 within floating-point tolerance; single-candidate placements | ||
| # leave unplaced mass off the tree and require at least half the mass at the | ||
| # reported site (`PLACEMENT_SINGLE_MIN_LWR`). | ||
| const PLACEMENT_WEIGHT_SUM_TOL = 1e-5 | ||
| # Placement tools truncate a query's candidate list at a likelihood-weight | ||
| # cutoff, so retained like-weight ratios can legitimately sum to a little | ||
| # under 1 (a single retained placement at 0.98 is complete evidence). A shortfall | ||
| # beyond the tolerance is a missing or discarded placement and stays undecided. | ||
| # A sum over 1 is never legitimate: weights are mutually exclusive placement | ||
| # ratios, so overweight evidence is malformed and is rejected by a tight upper | ||
| # bound while the lower shortfall is tolerated. | ||
| const PLACEMENT_WEIGHT_SUM_TOL = 0.05 | ||
| const PLACEMENT_WEIGHT_OVER_TOL = 1e-9 | ||
| const PLACEMENT_SINGLE_MIN_LWR = 0.5 | ||
|
|
||
| ## Phylogenetic tree structures & Newick / jplace parsers | ||
|
|
@@ -577,7 +581,7 @@ function parse_jplace(raw_json::AbstractString)::JplaceDocument | |
| elseif length(cands) == 1 && cands[1].like_weight < PLACEMENT_SINGLE_MIN_LWR | ||
| push!(queries, QueryPlacement(q_ord, q_names, cands, :undecided, | ||
| "weight_sum_out_of_tolerance ($(round(weight_sum; digits=6)))", nothing)) | ||
| elseif length(cands) > 1 && abs(weight_sum - 1.0) > PLACEMENT_WEIGHT_SUM_TOL | ||
| elseif length(cands) > 1 && (weight_sum > 1.0 + PLACEMENT_WEIGHT_OVER_TOL || weight_sum < 1.0 - PLACEMENT_WEIGHT_SUM_TOL) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When this condition newly admits a partition such as Useful? React with 👍 / 👎. |
||
| push!(queries, QueryPlacement(q_ord, q_names, cands, :undecided, | ||
| "weight_sum_out_of_tolerance ($(round(weight_sum; digits=6)))", nothing)) | ||
| else | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raising this shared constant to
0.05also changessrc/server/routes/clade_cumulus.jl:313-314, where it suppresses reporting any unplaced mass below 5%. For example, the existing route fixture has a valid placement with LWR0.99; its missing 1% was previously returned as 0.05/0.10 unplaced reads, but now0.99 < 0.95is false, so both values become zero and the assertions attest/unit/test_clade_cumulus.jl:477-478fail. Use a separate floating-point epsilon for unplaced-read accounting so the relaxed parser threshold does not hide discarded mass.Useful? React with 👍 / 👎.