Skip to content

Commit

Permalink
Fuzzy match tree labels
Browse files Browse the repository at this point in the history
  • Loading branch information
ms609 committed Jun 26, 2023
1 parent 6d893ba commit e592d83
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Imports:
shiny (>= 1.6.0),
shinyjs,
stats,
TreeDist (>= 2.5.0),
TreeDist (>= 2.6.1.9000),
TreeTools (>= 1.9.2.9002),
Suggests:
knitr,
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- Default to use equal weighting during ratchet iterations
- Support null constraints in `AdditionTree()`
- Allow search to continue when loading a new file with different taxon names
into the app

# TreeSearch 1.3.2 (2023-04-27)

Expand Down
10 changes: 8 additions & 2 deletions inst/Parsimony/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -1570,9 +1570,15 @@ server <- function(input, output, session) {
" # First tree with optimal score"))
r$trees[[firstOptimal]]
} else {
# TODO Could try fuzzy matching
# Fuzzy-match labels
oldTree <- r$trees[[1]]
oldLabels <- TipLabels(oldTree)
newLabels <- TipLabels(r$dataset)
matching <- TreeDist::LAPJV(adist(oldLabels, newLabels))$matching
scaffold <- KeepTip(oldTree, !is.na(matching))
scaffold[["tip.label"]] <- newLabels[matching[!is.na(matching)]]
AdditionTree(r$dataset, concavity = concavity(),
constraint = KeepTip(r$trees[[1]], TipLabels(r$dataset)))
constraint = scaffold)
}
}
LogMsg("StartSearch()")
Expand Down

0 comments on commit e592d83

Please sign in to comment.