You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/RadixTree.R
+30-11Lines changed: 30 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -141,15 +141,13 @@ RadixTree <- R6::R6Class("RadixTree", public = list(
141
141
#' @param show_progress `r rdoc("show_progress")`
142
142
#' @return The output is a data.frame of all matches with columns "query" and "target".
143
143
#' For anchored searches, the output also includes attributes "query_size" and "target_size" which are vectors containing the portion of the query and target sequences that are aligned.
stop("Internal error: anchored search results do not match pairwise results")
172
168
}
@@ -175,6 +171,29 @@ RadixTree <- R6::R6Class("RadixTree", public = list(
175
171
}
176
172
result
177
173
},
174
+
#' @description A specialized algorithm for searching for sequences allowing at most a single gap within the alignment itself. The mode is always "anchored" and does not penalize end gaps.
175
+
#' @param query `r rdoc("query")`
176
+
#' @param max_distance `r rdoc("max_distance")`
177
+
#' @param gap_cost `r rdoc("gap_cost")`
178
+
#' @param nthreads `r rdoc("nthreads")`
179
+
#' @param show_progress `r rdoc("show_progress")`
180
+
#' @return The output is a data.frame of matches with columns "query", "target" and "distance".
181
+
single_gap_search=function(query,
182
+
max_distance,
183
+
gap_cost=1L,
184
+
nthreads=1,
185
+
show_progress=FALSE) {
186
+
if (!is.null(max_distance)) {
187
+
max_distance<- recycle_arg(max_distance, query)
188
+
} else {
189
+
stop("Either max_distance must be non-null")
190
+
}
191
+
if (any(max_distance<0)) {
192
+
stop("max_distance/max_fraction must be non-negative")
#' @return A logical indicating whether the tree is valid (TRUE) or not (FALSE). This is mostly an internal function for debugging purposes and should always return TRUE.
0 commit comments