Commit c093df93 authored by smorabit's avatar smorabit
Browse files

plotDmeLollipop function

parent ad96f2ff
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
Package: hdWGCNA
Title: hdWGCNA
Version: 0.2.15
Version: 0.2.16
Authors@R: c(
    person("Sam", "Morabito", , "smorabit@uci.edu", role = c("aut", "cre"),
           comment = c(ORCID = "0000-0002-7768-4856")),
    person("Zechuan", "Shi", , "zechuas@uci.edu", role = c("ctb"),
          comment = c(ORCID = "0000-0002-2844-5816")),
    person("Swarup Lab", role = "fnd")
  )
Description: hdWGCNA is an R package for performing weighted gene co-expression network analysis in high dimensional data such as single-cell RNA-seq or spatial transcriptomics.
+2 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ export(OverlapBarPlot)
export(OverlapDotPlot)
export(OverlapModulesDEGs)
export(OverlapModulesMotifs)
export(PlotDMEsLollipop)
export(PlotDMEsVolcano)
export(PlotDendrogram)
export(PlotKMEs)
@@ -120,6 +121,7 @@ import(ggplot2)
import(harmony)
import(magrittr)
import(patchwork)
import(uwot)
importFrom(Matrix,colSums)
importFrom(Matrix,rowSums)
importFrom(dplyr,"%>%")
+8 −0
Original line number Diff line number Diff line
# hdWGCNA 0.2.16 (2023-03-02)
## Added
- `PlotDMEsLollipop` function to visualize differential module eigengenes.

## Changes
- New error checks in `MetacellsByGroups`


# hdWGCNA 0.2.15 (2023-03-02)
## Added
- None
+9 −2
Original line number Diff line number Diff line
@@ -5,16 +5,18 @@
#' @param seurat_obj A Seurat object
#' @param n_hubs number of hub genes to use in the UMAP computation
#' @param exclude_grey logical indicating whether to include grey module
#' @param genes_use character vector of genes to use for the UMAP, must already be present in GetModules(seurat_obj)
#' @param wgcna_name The name of the hdWGCNA experiment in the seurat_obj@misc slot
#' @param ... Additional parameters supplied to uwot::umap
#' @keywords scRNA-seq
#' @import uwot
#' @import Seurat
#' @export
#' @examples
RunModuleUMAP <- function(
  seurat_obj,
  features = "TOM", # "TOM" or "kME"
  n_hubs = 10,
  exclude_grey = TRUE,
  genes_use = NULL,
  wgcna_name = NULL,
  n_neighbors= 25,
  metric = "cosine",
@@ -35,6 +37,7 @@ RunModuleUMAP <- function(
    stop('Eigengene-based connectivity (kME) not found. Did you run ModuleEigengenes and ModuleConnectivity?')
  }

  # handle excluding grey module
  if(exclude_grey){
    mods <- mods[mods != 'grey']
    modules <- subset(modules, module != 'grey')
@@ -51,6 +54,10 @@ RunModuleUMAP <- function(
  # get all genes that aren't in gray mod
  selected_genes <- modules[modules$module %in% mods,'gene_name']

  if(!is.null(genes_use)){
    selected_genes <- selected_genes[selected_genes %in% genes_use]
  } 

  # get the TOM
  TOM <- GetTOM(seurat_obj, wgcna_name)

+26 −1
Original line number Diff line number Diff line
@@ -254,10 +254,12 @@ MetacellsByGroups <- function(
    stop('Invalid character # found in group.by, please re-name the group.')
  }

  # check ident.group
  if(!(ident.group %in% group.by)){
    stop('ident.group must be in group.by')
  }

  # check mode
  if(!(mode %in% c('sum', 'average'))){
    stop('Invalid choice for mode. Mode can be either sum or average.')
  }
@@ -286,6 +288,17 @@ MetacellsByGroups <- function(
    }
  }

  # check that k > min_cells 
  if(min_cells < k ){
    warning("min_cells is smaller than k, this may result in downstream errors if very small groups are allowed.")
  }

  # check that max_shared is valid:
  if(max_shared < 0){
    max_shared <- 0
    warning(paste0("max_shared specified (", max_shared, ') is too low, setting max_shared <- 0'))
  }

  # subset seurat object by seleted cells:
  if(!is.null(cells.use)){
    seurat_full <- seurat_obj
@@ -337,7 +350,19 @@ MetacellsByGroups <- function(
    seurat_obj = seurat_list,
    name = groupings,
    meta = meta_list,
    MoreArgs = list(k=k, reduction=reduction, assay=assay, slot=slot, return_metacell=TRUE, mode=mode, max_shared=max_shared, max_iter=max_iter, target_metacells=target_metacells, verbose=verbose, wgcna_name=wgcna_name)
    MoreArgs = list(
      k=k, 
      reduction=reduction, 
      assay=assay, 
      slot=slot, 
      return_metacell=TRUE, 
      mode=mode,
       max_shared=max_shared, 
       max_iter=max_iter, 
       target_metacells=target_metacells, 
       verbose=verbose, 
       wgcna_name=wgcna_name
    )
  )
  names(metacell_list) <- groupings

Loading