Commit 9ed9084d authored by smorabit's avatar smorabit
Browse files

bugfix in ModuleConnectivity

parent 7e3e500e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
Package: hdWGCNA
Package: hdWGCNA
Title: hdWGCNA
Title: hdWGCNA
Version: 0.1.1.9013
Version: 0.1.1.9014
Authors@R: c(
Authors@R: c(
    person("Sam", "Morabito", , "smorabit@uci.edu", role = c("aut", "cre"),
    person("Sam", "Morabito", , "smorabit@uci.edu", role = c("aut", "cre"),
           comment = c(ORCID = "0000-0002-7768-4856")),
           comment = c(ORCID = "0000-0002-7768-4856")),
+8 −0
Original line number Original line Diff line number Diff line
# hdWGCNA 0.1.1.9012 (2022-08-26)
## Added
- None

## Changes
- Bugfix in `ModuleConnectivity` that caused kMEs to be out of order.


# hdWGCNA 0.1.1.9012 (2022-08-25)
# hdWGCNA 0.1.1.9012 (2022-08-25)
## Added
## Added
- Tutorial for using SCTransform normalized data.
- Tutorial for using SCTransform normalized data.
+4 −1
Original line number Original line Diff line number Diff line
@@ -962,8 +962,11 @@ ModuleConnectivity <- function(


  # add module color to the kMEs table
  # add module color to the kMEs table
  modules <- modules[,1:3]
  modules <- modules[,1:3]
  mods <- levels(modules$module)
  colnames(kMEs) <- colnames(MEs)
  kMEs <- kMEs[,mods]
  colnames(kMEs) <- paste0("kME_", colnames(kMEs))
  kMEs <- cbind(modules, kMEs)
  kMEs <- cbind(modules, kMEs)
  colnames(kMEs) <- c(colnames(modules), paste0("kME_", colnames(MEs)))


  # update the modules table in the Seurat object:
  # update the modules table in the Seurat object:
  seurat_obj <- SetModules(seurat_obj, kMEs, wgcna_name)
  seurat_obj <- SetModules(seurat_obj, kMEs, wgcna_name)
+20 −2
Original line number Original line Diff line number Diff line
@@ -1203,8 +1203,27 @@ ResetModuleNames <- function(
  # get modules
  # get modules
  modules <- GetModules(seurat_obj, wgcna_name)
  modules <- GetModules(seurat_obj, wgcna_name)
  old_mods <- levels(modules$module)
  old_mods <- levels(modules$module)
  nmods <- length(old_mods) - 1


  # if it's a named list:
  if(class(new_name) == 'list'){
    if(all(names(new_name) %in% old_mods)){
      ix <- match(names(new_name), old_mods)
      new_names <- old_mods
      new_names[ix] <- as.character(new_name)
      new_names <- new_names[new_names != 'grey']
    } else{
      stop("Some module names present in new_name are not found in this hdWGCNA experiment.")
    }
  } else if(length(new_name) == 1){
    new_names <- paste0(new_name, 1:nmods)
  } else if(length(new_name) == nmods){
    new_names <- new_name
  } else{
    stop("Invalid input for new_name.")
  }


  new_names <- paste0(new_name, 1:(length(old_mods)-1))
  grey_ind <- which(old_mods == 'grey')
  grey_ind <- which(old_mods == 'grey')


  # account for when grey is first / last
  # account for when grey is first / last
@@ -1352,7 +1371,6 @@ ResetModuleColors <- function(


  # case where we give a named list:
  # case where we give a named list:
  if(class(new_colors) == 'list'){
  if(class(new_colors) == 'list'){
    print('named list')
    ix <- match(names(new_colors), mod_colors_df$module)
    ix <- match(names(new_colors), mod_colors_df$module)
    mod_colors_df[ix, 'color'] <- as.character(new_colors)
    mod_colors_df[ix, 'color'] <- as.character(new_colors)
    new_colors <- mod_colors_df$color
    new_colors <- mod_colors_df$color
+1 −1
Original line number Original line Diff line number Diff line
@@ -39,7 +39,7 @@
      </button>
      </button>
      <span class="navbar-brand">
      <span class="navbar-brand">
        <a class="navbar-link" href="https://smorabit.github.io/hdWGCNA/index.html">hdWGCNA</a>
        <a class="navbar-link" href="https://smorabit.github.io/hdWGCNA/index.html">hdWGCNA</a>
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">0.1.1.9013</span>
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">0.1.1.9014</span>
      </span>
      </span>
    </div>
    </div>


Loading