Skip to content

Commit

Permalink
Bug fixes:
Browse files Browse the repository at this point in the history
- Nearest neighbor and count within summaries work correctly if detailed data is not requested.
- Correctly double-escape *all* backslashes in the slide id prefix.
  • Loading branch information
AB-Kent committed Oct 5, 2020
1 parent 8ceadf8 commit f454917
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/distance_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ nearest_neighbor_summary_single_impl = function(csd, phenotypes,
dplyr::ungroup()

# Optionally save details with a subset of columns
if (!is.null(details_path)) {
if (!is.null(details_path) && length(details_path) > 0 && nrow(distances) > 0) {
distances_subset = distances %>%
dplyr::select(!!.by, `Cell ID`, `Cell X Position`, `Cell Y Position`,
!!field_col,
Expand Down Expand Up @@ -307,7 +307,7 @@ count_within_summary_impl = function(csd, phenotypes, radii,
dplyr::ungroup()

# Optionally save details with a subset of columns
if (!is.null(category_path) && nrow(counts) > 0) {
if (!is.null(category_path) && length(category_path) > 0 && nrow(counts) > 0) {
counts_subset = counts %>%
dplyr::select(!!.by, `Cell ID`, `Cell X Position`, `Cell Y Position`,
!!field_col,
Expand Down
2 changes: 1 addition & 1 deletion inst/analysis_app/formatters.R
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ format_cleanup = function(slide_id_prefix, use_regex, has) {

# Now slide_id_prefix is a valid regex. We still have to double-escape \
# to put it into a string literal.
slide_id_prefix = stringr::str_replace(slide_id_prefix,
slide_id_prefix = stringr::str_replace_all(slide_id_prefix,
stringr::fixed('\\'), '\\\\')

# Note: Don't use mutate() in cleanup(),
Expand Down

0 comments on commit f454917

Please sign in to comment.