Skip to content

Commit

Permalink
fix referencing dplyr bug in vizClusters
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaeldossantospeixoto committed May 28, 2024
1 parent 4cd74bb commit 02f54ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ vizClusters <- function(cells, ofInterest = NULL,
## separate cells of interest to plot on top of others
if(!is.null(ofInterest)){
cells <- cells %>%
mutate(celltypes =
case_when((!cells$celltypes %in% ofInterest) ~ 'other',
T ~ celltypes))
dplyr::mutate(celltypes =
dplyr::case_when((!cells$celltypes %in% ofInterest) ~ 'other',
T ~ celltypes))
# cells$celltypes <- droplevels(cells$celltypes)
}

## order cell types based on abundance
ordered_cts <- c(names(sort(table(cells$celltypes), decreasing = T)))
ordered_cts <- c('other', ordered_cts[ordered_cts != 'other'])
cells <- cells %>%
arrange(match(celltypes, ordered_cts))
dplyr::arrange(match(celltypes, ordered_cts))

## plot
plt <- ggplot2::ggplot() +
Expand Down

0 comments on commit 02f54ab

Please sign in to comment.