R/phenograph.R

Defines functions varbin_pheno

Documented in varbin_pheno

#' Run Phenograph on varbin data
#'
#' @param umap_df
#'
#' @return
#' @export
#'
#' @examples
varbin_pheno <- function(umap_df) {
  pheno <- Rphenograph::Rphenograph(umap_df, k = 30)
  cl <- tibble(cell = rownames(umap_df),
               cluster = membership(pheno[[2]])) %>%
    arrange(cluster)
  # reordering
  umap_df <- umap_df[cl$cell,]
  # ordering cells
  seg_df_cells_t <- seg_df_cells_t[cl$cell,]

  # setting colors
  n_colors <- cl$cluster %>% unique() %>% length()

  row_col <- setNames(colorRampPalette(paletteer::paletteer_d(pals,
                                                              alphabet, 26))(n_colors),
                      levels(as.factor(cl$cluster)))
}
whtns/varbintools documentation built on Dec. 1, 2019, 5:15 a.m.