diff --git a/DESCRIPTION b/DESCRIPTION index eac3f836..1d300b62 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: hdWGCNA Title: hdWGCNA -Version: 0.3.00 +Version: 0.3.01 Authors@R: c( person("Sam", "Morabito", , "smorabit@uci.edu", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7768-4856")), diff --git a/NEWS.md b/NEWS.md index 2f90cfea..0bf4042e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +# hdWGCNA 0.3.01 (2024-03-07) +## Added +- None + +## Changes +- Bugfix in `ModulePreservation` +- Update to module preservation tutorial and project modules tutorial. + # hdWGCNA 0.3.00 (2024-02-27) ## Added - First version with support for Seurat v5. diff --git a/R/ModulePreservation.R b/R/ModulePreservation.R index b4fda8e3..886b1b5e 100644 --- a/R/ModulePreservation.R +++ b/R/ModulePreservation.R @@ -49,13 +49,19 @@ ModulePreservation <- function( colnames(datExpr_query) <- gene_mapping[,genome1_col] } + genes_keep <- intersect(colnames(datExpr_ref), colnames(datExpr_query)) + datExpr_ref <- datExpr_ref[,genes_keep] + datExpr_query <- datExpr_query[,genes_keep] + # set up multiExpr: setLabels <- c("ref", "query") multiExpr <- list( ref = list(data=datExpr_ref), query = list(data=datExpr_query) ) - ref_modules <- list(ref = GetModules(seurat_ref, wgcna_name=wgcna_name)$module) + ref_modules <- GetModules(seurat_ref, wgcna_name=wgcna_name_ref) + ref_modules <- ref_modules[genes_keep,] + ref_modules <- list(ref = ref_modules$module) # print('ref:') # print(dim(multiExpr$ref$data)) diff --git a/R/ProjectModules.R b/R/ProjectModules.R index 48a066cd..476899ea 100644 --- a/R/ProjectModules.R +++ b/R/ProjectModules.R @@ -35,6 +35,7 @@ ProjectModules <- function( # get data from active assay if wgcna_name is not given if(is.null(wgcna_name)){wgcna_name <- seurat_ref@misc$active_wgcna} + CheckWGCNAName(seurat_ref, wgcna_name) # get modules to be projected: if(is.null(modules)){ diff --git a/R/plotting.R b/R/plotting.R index c76b7999..daed682b 100644 --- a/R/plotting.R +++ b/R/plotting.R @@ -1725,8 +1725,6 @@ DoHubGeneHeatmap <- function( #' @param wgcna_name The name of the hdWGCNA experiment in the seurat_obj@misc slot #' @keywords scRNA-seq #' @export -#' @examples -#' PlotModulePreservation PlotModulePreservation <- function( seurat_obj, name, @@ -1847,8 +1845,6 @@ PlotModulePreservation <- function( #' @param combine logical determining whether to plot as one combined plot (TRUE) or to return individual plots as a list (FALSE) #' @keywords scRNA-seq #' @export -#' @examples -#' PlotModulePreservation PlotModuleTraitCorrelation <- function( seurat_obj, high_color = 'red', diff --git a/docs/404.html b/docs/404.html index c99cbc5c..fed0ee0d 100644 --- a/docs/404.html +++ b/docs/404.html @@ -39,7 +39,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/LICENSE.html b/docs/LICENSE.html index a420da9f..edfa056f 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/articles/ST_basics.html b/docs/articles/ST_basics.html index 787ed90b..8f16a6ea 100644 --- a/docs/articles/ST_basics.html +++ b/docs/articles/ST_basics.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/articles/basic_tutorial.html b/docs/articles/basic_tutorial.html index 2b7b3d42..7c667da6 100644 --- a/docs/articles/basic_tutorial.html +++ b/docs/articles/basic_tutorial.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/articles/consensus_wgcna.html b/docs/articles/consensus_wgcna.html index e7a2edbe..05cebc44 100644 --- a/docs/articles/consensus_wgcna.html +++ b/docs/articles/consensus_wgcna.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/articles/customization.html b/docs/articles/customization.html index f575c866..396b348c 100644 --- a/docs/articles/customization.html +++ b/docs/articles/customization.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/articles/differential_MEs.html b/docs/articles/differential_MEs.html index cf078e4c..2fe48906 100644 --- a/docs/articles/differential_MEs.html +++ b/docs/articles/differential_MEs.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/articles/enrichment_analysis.html b/docs/articles/enrichment_analysis.html index 4bd95b6a..78ad121b 100644 --- a/docs/articles/enrichment_analysis.html +++ b/docs/articles/enrichment_analysis.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/articles/figures/.DS_Store b/docs/articles/figures/.DS_Store index 4483e9d1..54b56e79 100644 Binary files a/docs/articles/figures/.DS_Store and b/docs/articles/figures/.DS_Store differ diff --git a/docs/articles/figures/projection/compare_umaps.png b/docs/articles/figures/projection/compare_umaps.png index b4964cb6..1eddc485 100644 Binary files a/docs/articles/figures/projection/compare_umaps.png and b/docs/articles/figures/projection/compare_umaps.png differ diff --git a/docs/articles/figures/projection/module_preservation_all.png b/docs/articles/figures/projection/module_preservation_all.png index 47e752c6..1431d977 100644 Binary files a/docs/articles/figures/projection/module_preservation_all.png and b/docs/articles/figures/projection/module_preservation_all.png differ diff --git a/docs/articles/figures/projection/module_preservation_rank.png b/docs/articles/figures/projection/module_preservation_rank.png index ee8b3bf9..5f140933 100644 Binary files a/docs/articles/figures/projection/module_preservation_rank.png and b/docs/articles/figures/projection/module_preservation_rank.png differ diff --git a/docs/articles/figures/projection/module_preservation_summary.png b/docs/articles/figures/projection/module_preservation_summary.png index 9465e6a1..51a82d91 100644 Binary files a/docs/articles/figures/projection/module_preservation_summary.png and b/docs/articles/figures/projection/module_preservation_summary.png differ diff --git a/docs/articles/figures/projection/projected_dotplot.png b/docs/articles/figures/projection/projected_dotplot.png index efb014ff..5f875f1c 100644 Binary files a/docs/articles/figures/projection/projected_dotplot.png and b/docs/articles/figures/projection/projected_dotplot.png differ diff --git a/docs/articles/figures/projection/projected_featureplots.png b/docs/articles/figures/projection/projected_featureplots.png index 67a2b729..b80c58f0 100644 Binary files a/docs/articles/figures/projection/projected_featureplots.png and b/docs/articles/figures/projection/projected_featureplots.png differ diff --git a/docs/articles/hdWGCNA.html b/docs/articles/hdWGCNA.html index 7873a769..c4fdb98a 100644 --- a/docs/articles/hdWGCNA.html +++ b/docs/articles/hdWGCNA.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/articles/index.html b/docs/articles/index.html index 6974a41c..c3448a01 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/articles/isoform_pbmcs.html b/docs/articles/isoform_pbmcs.html index e00f4c6a..a1d150ea 100644 --- a/docs/articles/isoform_pbmcs.html +++ b/docs/articles/isoform_pbmcs.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/articles/module_preservation.html b/docs/articles/module_preservation.html index e5733168..390790a5 100644 --- a/docs/articles/module_preservation.html +++ b/docs/articles/module_preservation.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -158,8 +158,9 @@

Module preservation and reproducibility

-

Data-driven models are thought to be useful when they are generalizable across different datasets. If we think about co-expression networks from this perspective, we need a way to statistically quantify the conservation of co-expression modules that were identified in one datasets across external datasets. This is a common theme in machine learning, where a model is learned on a training dataset but evaluated using an external validation dataset.

-

In the previous tutorial, we projected the co-expression modules from a reference to a query dataset, but we did not quantify the degree to which these modules were preserved across datasets. In this tutorial, we perform statistical tests to estimate the conservation of projected modules.

+

Compiled: 07-03-2024

+

Source: vignettes/basic_tutorial.Rmd

+

Data-driven models are most useful when they are generalizable across different datasets. Thinking about co-expression networks from this perspective, we need a way to quantify and test the conservation of co-expression patterns identified in one dataset across external datasets. In this tutorial, we demonstrate module preservation analysis with hdWGCNA, a statistical framewoerk that allows us to test the degree to which co-expression modules identified in one dataset are “preserved” in another dataset. This tutorial builds off of a previous tutorial, where we projected the co-expression modules from a reference dataset to a query dataset.

First we must load the data and the required libraries:

 # single-cell analysis package
@@ -197,40 +198,31 @@ 

Module preservation analysisseurat_query <- ProjectModules( seurat_obj = seurat_query, seurat_ref = seurat_ref, - wgcna_name = "INH", - wgcna_name_proj="INH_projected", + wgcna_name = "tutorial", + wgcna_name_proj="projected", assay="RNA" # assay for query dataset )

-

Next, we set up the expression matrices for the query and reference datasets. Either the single-cell or the metacell gene expression matrices can be used here by setting the use_metacells flag in SetDatExpr. In general we recommend using the same matrix that was used to construct the network for the reference (in this case, the metacell matrix).

-
-# set expression matrix for reference dataset
-seurat_ref <- SetDatExpr(
-  seurat_ref,
-  group_name = "INH",
-  group.by = "cell_type"
-)
-
-# set expression matrix for query dataset:
-seurat_query <- SetDatExpr(
-  seurat_query,
-  group_name = "INH",
-  group.by = "cell_type",
-  use_metacells = FALSE
-)
+

Next, we set up the expression matrices for the query and reference datasets. Either the single-cell or the metacell gene expression matrices can be used here by setting the use_metacells flag in SetDatExpr. In general we recommend using the same matrix that was used to construct the network for the reference (in this case, the metacell matrix). If you have not already constructed metacells in the query dataset, you can do that prior to module preservation analysis.

-** Using the metacell expression matrix for the query dataset ** -

If you choose to use the metacell expression matrix for the query dataset, you have to first run MetacellsByGroups on the query dataset.

-
-# compute metacells
+See code to consruct metacells in the query dataset
+
+# construct metacells:
 seurat_query <- MetacellsByGroups(
   seurat_obj = seurat_query,
-  group.by = c("cell_type", "Sample"), 
-  reduction = 'harmony',
+  group.by = c("cell_type", "Sample"),
   k = 25,
-  max_shared = 10, 
+  max_shared = 12,
+  reduction = 'harmony',
   ident.group = 'cell_type'
 )
-seurat_query <- NormalizeMetacells(seurat_query)
+seurat_query <- NormalizeMetacells(seurat_query)
+
+# set expression matrix for reference dataset
+seurat_ref <- SetDatExpr(
+  seurat_ref,
+  group_name = "INH",
+  group.by = "cell_type"
+)
 
 # set expression matrix for query dataset:
 seurat_query <- SetDatExpr(
@@ -238,7 +230,8 @@ 

Module preservation analysis= "INH", group.by = "cell_type" )

-

Now we can run the ModulePreservation function. Note that this function does take a while to run since it is permutation based, but it can be sped up by lowering the n_permutations parameter, but we do not recommend any lower than 100 permutations. Also note that the parallel option currently does not work.

+

Now we can run the ModulePreservation function. Note that this function does take a while to run since it is a permutation test, but it can be sped up by lowering the n_permutations parameter, but we do not recommend any lower than 100 permutations. Also note that the parallel option currently does not work. For demonstration purposes, we ran the code for this tutorial using only 20 permutations so it would run quickly.

+

ModulePreservation takes a name parameter, which is used to store the results of this module perturbation test.

 # run module preservation function
 seurat_query <- ModulePreservation(
@@ -246,22 +239,24 @@ 

Module preservation analysis= seurat_ref, name="Zhou-INH", verbose=3, - n_permutations=250 -) - -# getthe module preservation table -mod_pres <- GetModulePreservation(seurat_query, "Zhou-INH")$Z -obs_df <- GetModulePreservation(seurat_query, "Zhou-INH")$obs - -grep('summary', colnames(mod_pres)) -grep('summary', colnames(obs))

-

Please consult this tutorial for an explanation of the different stats. Currently working on writing up a description of the stats on this page. The visualizations are inspired by those included in the original WGCNA module preservation tutorials.

+ n_permutations=250 # n_permutations=20 used for the tutorial +)
+

Visualize preservation stats

-

In this section, we use the function PlotModulePreservation to visualize the statistics we computed in the previous section. This function generates a scatter plot showing the module size versus the module preservation stats.

+

The module perturbation test produces a number of different preservation statistics, which you can inspect in the following tables.

+# get the module preservation table
+mod_pres <- GetModulePreservation(seurat_query, "Zhou-INH")$Z
+obs_df <- GetModulePreservation(seurat_query, "Zhou-INH")$obs
+

In the past we linked to the original WGCNA documentation website for more detailed explanations of thes statistics, but unfortunately at the time of writing this tutorial the website has been taken offline. Please refer to the original publication in PLOS Computational Biology for further explanations.

+

hdWGCNA includes the function PlotModulePreservation to visualize the statistics we computed in the previous section. This function generates a scatter plot showing the module size versus the module preservation stats. The summary statistics aggregate the individual preservation and quality statistics into a single metric so we generally recommend primarily interpreting the results with these plots.

+
 plot_list <- PlotModulePreservation(
   seurat_query,
   name="Zhou-INH",
@@ -270,8 +265,14 @@ 

Visualize preservation statswrap_plots(plot_list, ncol=2)

-

Plot the ranking stats

-
+

Here we can see three different shades in the background. These represent cutoff values for interpreting the Z summary statistics. The following guidelines help us understand the preservation of these modules.

+
    +
  • Z > 2, the module is not preserved in the query dataset.
  • +
  • 10 > Z > 2, the module is moderately preserved in the query dataset.
  • +
  • Z > 10, the module is highly preserved in the query dataset.
  • +
+

The following code shows how to plot additional module preservation stats.

+
 # plot ranking stats
 plot_list <- PlotModulePreservation(
   seurat_query,
@@ -280,12 +281,10 @@ 

Visualize preservation stats) -png(paste0(fig_dir, 'module_preservation_rank.png'), width=10, height=10, res=400, units='in') -wrap_plots(plot_list, ncol=2) -dev.off()

+wrap_plots(plot_list, ncol=2)

Plot all of the different stats:

-
+
 plot_list <- PlotModulePreservation(
   seurat_query,
   name="Zhou-INH",
diff --git a/docs/articles/module_trait_correlation.html b/docs/articles/module_trait_correlation.html
index b72e7463..7431454e 100644
--- a/docs/articles/module_trait_correlation.html
+++ b/docs/articles/module_trait_correlation.html
@@ -41,7 +41,7 @@
       
       
         hdWGCNA
-        0.3.00
+        0.3.01
       
     
diff --git a/docs/articles/motif_analysis.html b/docs/articles/motif_analysis.html index ab550d87..5b9d7d19 100644 --- a/docs/articles/motif_analysis.html +++ b/docs/articles/motif_analysis.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01
diff --git a/docs/articles/network_visualizations.html b/docs/articles/network_visualizations.html index bae176c1..77f372e7 100644 --- a/docs/articles/network_visualizations.html +++ b/docs/articles/network_visualizations.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01
diff --git a/docs/articles/other_metacells.html b/docs/articles/other_metacells.html index 490c3e67..36e1a53f 100644 --- a/docs/articles/other_metacells.html +++ b/docs/articles/other_metacells.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/articles/projecting_modules.html b/docs/articles/projecting_modules.html index 5d004bf8..5f7a1d64 100644 --- a/docs/articles/projecting_modules.html +++ b/docs/articles/projecting_modules.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -158,8 +158,10 @@

Projecting modules to new datasets

-

In this tutorial, we begin to analyze the co-expresion modules detected in one dataset in external datasets. Rather than building a new co-expression network from scratch in a new dataset, we can take the modules from one dataset and project them into the new dataset. Before starting this tutorial, make sure that you have constructed the co-expression network as in the hdWGCNA basics. The main hdWGCNA tutorials have been using the control brain samples from this publication, and now we will project the inhibitory neruon modules from Zhou et al into the control brain samples from Morabito and Miyoshi 2021.

-

First we must load the data and the required libraries:

+

Compiled: 07-03-2024

+

Source: vignettes/basic_tutorial.Rmd

+

In this tutorial, we show how to investigate co-expresion modules detected in one dataset in external datasets. Rather than building a new co-expression network from scratch in a new dataset, we can take the modules from one dataset and project them into the new dataset. A prerequisite for this tutorial is constructing a co-expression network in a single-cell or spatial transcritpomic dataset, see the single-cell basics or the spatial basics tutorial before proceeding. The main hdWGCNA tutorials have been using the control brain samples from this publication, and now we will project the inhibitory neruon modules from Zhou et al into the control brain snRNA-seq dataset from Morabito and Miyoshi 2021.

+

First we load the datasets and the required libraries:

 # single-cell analysis package
 library(Seurat)
@@ -190,7 +192,7 @@ 

Projecting modules to new datasets

Projecting modules from reference to query

-

In this section we project the modules from the Zhou et al inhibitory neuron hdWGCNA experiment into the Morabito & Miyoshi et al control brain dataset. We refer to the Zhou et al dataset as the “reference” dataset, and the Morabito & Miyoshi et al dataset as the “query” dataset. Just as we had done before when building the co-expression network from scratch, the basic single-cell pipeline has to be 0done on the query dataset (normalization, scaling, variable features, PCA, batch correction, UMAP, clustering). First we make a UMAP plot to visualize the two datasets to ensure they have both been processed.

+

In this section we project the modules from the Zhou et al inhibitory neuron hdWGCNA experiment into the Morabito & Miyoshi et al control brain dataset. We refer to the Zhou et al dataset as the “reference” dataset, and the Morabito & Miyoshi et al dataset as the “query” dataset. Just as we had done before when building the co-expression network from scratch, the basic single-cell pipeline has to be done on the query dataset (normalization, scaling, variable features, PCA, batch correction, UMAP, clustering). First we make a UMAP plot to visualize the two datasets to ensure they have both been processed.

Code
@@ -219,27 +221,22 @@ 

Projecting modules from refe seurat_ref = seurat_ref, # vars.to.regress = c(), # optionally regress covariates when running ScaleData group.by.vars = "Batch", # column in seurat_query to run harmony on - wgcna_name_proj="Zhou_projected", # name of the new hdWGCNA experiment in the query dataset + wgcna_name_proj="projected", # name of the new hdWGCNA experiment in the query dataset wgcna_name = "tutorial" # name of the hdWGCNA experiment in the ref dataset )

As you can see it only takes running one function to project co-expression modules from one dataset into another using hdWGCNA. Optionally, we can also compute the hub gene expression scores and the intramodular connectivity for the projected modules. Note that if we do not run the ModuleConnectivity function on the query dataset, the kME values in the module assignment table GetModules(seurat_query) are the kME values from the reference dataset.

-# compute module hub gene expression scores for projected modules:
-seurat_query <- ModuleExprScore(
+seurat_query <- ModuleConnectivity(
   seurat_query,
-  n_genes = 25,
-  method='Seurat'
+  group.by = 'cell_type', group_name = 'INH'
 )
 
-# compute intramodular connectivity
-seurat_query <- ModuleConnectivity(seurat_query, assay="RNA", slot="data")
-

Save the query Seurat object after projecting modules.

-
-saveRDS(seurat_query, file=paste0(data_dir, 'Morabito_Miyoshi_2021_control.rds'))
-
-seurat_query <- readRDS(paste0(data_dir, 'Swarup2021_control_hdWGCNA_modpres.rds'))
+seurat_query <- ModuleExprScore( + seurat_query, + method='UCell' +)

We can extract the projected module eigengenes using the GetMEs function.

-
+
 projected_hMEs <- GetModules(seurat_query)

The projected modules can be used in most of the downstream hdWGCNA analysis tasks and visualization functions, such as module trait correlation, however it is important to note that some of the functions cannot be run on the projected modules. In particular, we cannot make any of the network plots since we did not actually construct a co-expression network in the query dataset, so running functions such as RunModuleUMAP and ModuleNetworks will throw an error.

@@ -247,32 +244,33 @@

Projecting modules from refe

Visualization

In this section we demonstrate some of the visualization functions for the projected modules in the query dataset. First, we use the ModuleFeaturePlot function to visualizes the hMEs on the UMAP:

-
+
 # make a featureplot of hMEs for each module
 plot_list <- ModuleFeaturePlot(
   seurat_query,
   features='hMEs',
-  order=TRUE
+  order=TRUE,
+  restrict_range=FALSE
 )
 
 # stitch together with patchwork
 wrap_plots(plot_list, ncol=6)

Next we will make a dot plot for each of the modules grouped by cell type identity.

-
-# get the projected hMEs
-projected_hMEs <-  GetMEs(seurat_query, harmonized=TRUE)
+
+# get the projected MEs
+projected_MEs <-  GetMEs(seurat_query)
 
-# add hMEs to Seurat meta-data:
+# add MEs to Seurat meta-data:
 seurat_query@meta.data <- cbind(
   seurat_query@meta.data,
-  projected_hMEs
+  projected_MEs
 )
 
 # plot with Seurat's DotPlot function
 p <- DotPlot(
     seurat_query,
-    features = colnames(projected_hMEs),
+    features = colnames(projected_MEs),
     group.by = 'cell_type'
 )
 
diff --git a/docs/articles/projecting_modules_cross.html b/docs/articles/projecting_modules_cross.html
index 331906b1..bbcccb0f 100644
--- a/docs/articles/projecting_modules_cross.html
+++ b/docs/articles/projecting_modules_cross.html
@@ -41,7 +41,7 @@
       
       
         hdWGCNA
-        0.3.00
+        0.3.01
       
     
diff --git a/docs/articles/pseudobulk.html b/docs/articles/pseudobulk.html index 81ab5739..855bc8f9 100644 --- a/docs/articles/pseudobulk.html +++ b/docs/articles/pseudobulk.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01
diff --git a/docs/articles/pseudotime.html b/docs/articles/pseudotime.html index bcbd0def..6c5358a2 100644 --- a/docs/articles/pseudotime.html +++ b/docs/articles/pseudotime.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01
diff --git a/docs/articles/sctransform.html b/docs/articles/sctransform.html index ae91db24..bd473abc 100644 --- a/docs/articles/sctransform.html +++ b/docs/articles/sctransform.html @@ -41,7 +41,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/authors.html b/docs/authors.html index ca5c0c0c..e0e2f583 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/index.html b/docs/index.html index c4e902f1..669f7bc0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -40,7 +40,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/news/index.html b/docs/news/index.html index ebc449d3..bf625b3f 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -115,6 +115,19 @@

Changelog

+
+ +
+

Added

+
  • None
  • +
+
+

Changes

+
  • Bugfix in ModulePreservation +
  • +
  • Update to module preservation tutorial and project modules tutorial.
  • +
+
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 82b99b33..4fa2fd6b 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -20,7 +20,7 @@ articles: pseudobulk: pseudobulk.html pseudotime: pseudotime.html sctransform: sctransform.html -last_built: 2024-02-28T06:02Z +last_built: 2024-03-08T02:39Z urls: reference: https://smorabit.github.io/hdWGCNA/reference article: https://smorabit.github.io/hdWGCNA/articles diff --git a/docs/reference/AvgModuleExpr.html b/docs/reference/AvgModuleExpr.html index 752facbd..4e1d1ca7 100644 --- a/docs/reference/AvgModuleExpr.html +++ b/docs/reference/AvgModuleExpr.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01
diff --git a/docs/reference/BinPseudotime.html b/docs/reference/BinPseudotime.html index 9bafb2b0..7fa93bac 100644 --- a/docs/reference/BinPseudotime.html +++ b/docs/reference/BinPseudotime.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01
diff --git a/docs/reference/CheckSeurat5.html b/docs/reference/CheckSeurat5.html index 0f59692a..015923e1 100644 --- a/docs/reference/CheckSeurat5.html +++ b/docs/reference/CheckSeurat5.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/CheckWGCNAName.html b/docs/reference/CheckWGCNAName.html index c99a38f4..109f403e 100644 --- a/docs/reference/CheckWGCNAName.html +++ b/docs/reference/CheckWGCNAName.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ComputeModuleEigengene.html b/docs/reference/ComputeModuleEigengene.html index 18ac359f..a6d42792 100644 --- a/docs/reference/ComputeModuleEigengene.html +++ b/docs/reference/ComputeModuleEigengene.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ConstructMetacells.html b/docs/reference/ConstructMetacells.html index daf67fb8..e143a73f 100644 --- a/docs/reference/ConstructMetacells.html +++ b/docs/reference/ConstructMetacells.html @@ -18,7 +18,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ConstructMetaspots.html b/docs/reference/ConstructMetaspots.html index 6277fc23..72d4ecbb 100644 --- a/docs/reference/ConstructMetaspots.html +++ b/docs/reference/ConstructMetaspots.html @@ -18,7 +18,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ConstructNetwork.html b/docs/reference/ConstructNetwork.html index ee2b4520..dd264e41 100644 --- a/docs/reference/ConstructNetwork.html +++ b/docs/reference/ConstructNetwork.html @@ -18,7 +18,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ConstructPseudobulk.html b/docs/reference/ConstructPseudobulk.html index 3de248b7..0abf09b3 100644 --- a/docs/reference/ConstructPseudobulk.html +++ b/docs/reference/ConstructPseudobulk.html @@ -19,7 +19,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/DimPlotMetacells.html b/docs/reference/DimPlotMetacells.html index 20ccc3d5..8a193242 100644 --- a/docs/reference/DimPlotMetacells.html +++ b/docs/reference/DimPlotMetacells.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/DoHubGeneHeatmap.html b/docs/reference/DoHubGeneHeatmap.html index 54f1c483..27178bdc 100644 --- a/docs/reference/DoHubGeneHeatmap.html +++ b/docs/reference/DoHubGeneHeatmap.html @@ -18,7 +18,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -242,7 +242,7 @@

Examples

#> } #> out #> } -#> <bytecode: 0x7fc97dabe368> +#> <bytecode: 0x7fca9009b430> #> <environment: namespace:hdWGCNA>
diff --git a/docs/reference/EnrichrBarPlot.html b/docs/reference/EnrichrBarPlot.html index 270cf998..184968bd 100644 --- a/docs/reference/EnrichrBarPlot.html +++ b/docs/reference/EnrichrBarPlot.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -230,7 +230,7 @@

Examples

#> dev.off() #> } #> } -#> <bytecode: 0x7fc9804e20b0> +#> <bytecode: 0x7fca90b39e88> #> <environment: namespace:hdWGCNA>
diff --git a/docs/reference/EnrichrDotPlot.html b/docs/reference/EnrichrDotPlot.html index 79005b52..45c09fb4 100644 --- a/docs/reference/EnrichrDotPlot.html +++ b/docs/reference/EnrichrDotPlot.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -202,7 +202,7 @@

Examples

#> fill = NA, size = 1)) #> p #> } -#> <bytecode: 0x7fc982784828> +#> <bytecode: 0x7fca93a2c000> #> <environment: namespace:hdWGCNA>
diff --git a/docs/reference/FindAllDMEs.html b/docs/reference/FindAllDMEs.html index 95043c93..e4bd1450 100644 --- a/docs/reference/FindAllDMEs.html +++ b/docs/reference/FindAllDMEs.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -171,9 +171,7 @@

Examples

#> if (is.null(wgcna_name)) { #> wgcna_name <- seurat_obj@misc$active_wgcna #> } -#> if (!CheckWGCNAName(seurat_obj, wgcna_name)) { -#> stop(paste0("Invalid wgcna_name supplied: ", wgcna_name)) -#> } +#> CheckWGCNAName(seurat_obj, wgcna_name) #> groups <- as.character(unique(seurat_obj@meta.data[[group.by]])) #> if (features == "MEs") { #> MEs <- GetMEs(seurat_obj, harmonized, wgcna_name) @@ -215,7 +213,7 @@

Examples

#> DMEs <- do.call(rbind, DMEs_list) #> DMEs #> } -#> <bytecode: 0x7fc983488698> +#> <bytecode: 0x7fca94619d60> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/FindDMEs.html b/docs/reference/FindDMEs.html index eb8bca3c..a6c6100f 100644 --- a/docs/reference/FindDMEs.html +++ b/docs/reference/FindDMEs.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -174,9 +174,7 @@

Examples

#> if (is.null(wgcna_name)) { #> wgcna_name <- seurat_obj@misc$active_wgcna #> } -#> if (!CheckWGCNAName(seurat_obj, wgcna_name)) { -#> stop(paste0("Invalid wgcna_name supplied: ", wgcna_name)) -#> } +#> CheckWGCNAName(seurat_obj, wgcna_name) #> if (!(all(barcodes1 %in% colnames(seurat_obj)))) { #> stop("Some barcodes in barcodes1 not found in colnames(seurat_obj).") #> } @@ -214,7 +212,7 @@

Examples

#> } #> DMEs #> } -#> <bytecode: 0x7fc983d484f8> +#> <bytecode: 0x7fca778d0940> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/FindMajorIsoforms.html b/docs/reference/FindMajorIsoforms.html index db2f057f..9502c2e0 100644 --- a/docs/reference/FindMajorIsoforms.html +++ b/docs/reference/FindMajorIsoforms.html @@ -19,7 +19,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetActiveWGCNA.html b/docs/reference/GetActiveWGCNA.html index 1920da92..9e6cbe21 100644 --- a/docs/reference/GetActiveWGCNA.html +++ b/docs/reference/GetActiveWGCNA.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetActiveWGCNAName.html b/docs/reference/GetActiveWGCNAName.html index ed2a6809..1e1f92d0 100644 --- a/docs/reference/GetActiveWGCNAName.html +++ b/docs/reference/GetActiveWGCNAName.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetAvgModuleExpr.html b/docs/reference/GetAvgModuleExpr.html index 12c074ab..09df1b40 100644 --- a/docs/reference/GetAvgModuleExpr.html +++ b/docs/reference/GetAvgModuleExpr.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetDatExpr.html b/docs/reference/GetDatExpr.html index 600f56ea..bb8b521f 100644 --- a/docs/reference/GetDatExpr.html +++ b/docs/reference/GetDatExpr.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetEnrichrTable.html b/docs/reference/GetEnrichrTable.html index 76bfd11b..05741584 100644 --- a/docs/reference/GetEnrichrTable.html +++ b/docs/reference/GetEnrichrTable.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetHubGenes.html b/docs/reference/GetHubGenes.html index 142ad82d..13e6dce5 100644 --- a/docs/reference/GetHubGenes.html +++ b/docs/reference/GetHubGenes.html @@ -19,7 +19,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetMELoadings.html b/docs/reference/GetMELoadings.html index 75d28549..800a188f 100644 --- a/docs/reference/GetMELoadings.html +++ b/docs/reference/GetMELoadings.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetMEs.html b/docs/reference/GetMEs.html index 2c1e2c9c..c497eb09 100644 --- a/docs/reference/GetMEs.html +++ b/docs/reference/GetMEs.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetMetacellObject.html b/docs/reference/GetMetacellObject.html index dd0856b2..a122fc72 100644 --- a/docs/reference/GetMetacellObject.html +++ b/docs/reference/GetMetacellObject.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetModulePreservation.html b/docs/reference/GetModulePreservation.html index dc254722..70f6c427 100644 --- a/docs/reference/GetModulePreservation.html +++ b/docs/reference/GetModulePreservation.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetModuleScores.html b/docs/reference/GetModuleScores.html index c3125de4..2cb0eda8 100644 --- a/docs/reference/GetModuleScores.html +++ b/docs/reference/GetModuleScores.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetModuleTraitCorrelation.html b/docs/reference/GetModuleTraitCorrelation.html index 7590679b..9e57f74d 100644 --- a/docs/reference/GetModuleTraitCorrelation.html +++ b/docs/reference/GetModuleTraitCorrelation.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetModuleUMAP.html b/docs/reference/GetModuleUMAP.html index e358e74e..8d4645a7 100644 --- a/docs/reference/GetModuleUMAP.html +++ b/docs/reference/GetModuleUMAP.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetModules.html b/docs/reference/GetModules.html index 05754c45..d2206969 100644 --- a/docs/reference/GetModules.html +++ b/docs/reference/GetModules.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetMotifMatrix.html b/docs/reference/GetMotifMatrix.html index dc69198e..af951f9e 100644 --- a/docs/reference/GetMotifMatrix.html +++ b/docs/reference/GetMotifMatrix.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -137,7 +137,7 @@

Examples

#> { #> seurat_obj@misc$motifs$tf_match_matrix #> } -#> <bytecode: 0x7fc97c197708> +#> <bytecode: 0x7fca8cb16828> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/GetMotifOverlap.html b/docs/reference/GetMotifOverlap.html index 8095904f..faf457ee 100644 --- a/docs/reference/GetMotifOverlap.html +++ b/docs/reference/GetMotifOverlap.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetMotifScores.html b/docs/reference/GetMotifScores.html index 0644d036..f19cbf0e 100644 --- a/docs/reference/GetMotifScores.html +++ b/docs/reference/GetMotifScores.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetMotifTargets.html b/docs/reference/GetMotifTargets.html index ad174acf..cc08140b 100644 --- a/docs/reference/GetMotifTargets.html +++ b/docs/reference/GetMotifTargets.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -137,7 +137,7 @@

Examples

#> { #> seurat_obj@misc$motifs$motif_targets #> } -#> <bytecode: 0x7fc9802df0b8> +#> <bytecode: 0x7fca91372ef0> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/GetMotifs.html b/docs/reference/GetMotifs.html index 7871a24b..77b58473 100644 --- a/docs/reference/GetMotifs.html +++ b/docs/reference/GetMotifs.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -137,7 +137,7 @@

Examples

#> { #> seurat_obj@misc$motifs$motif_df #> } -#> <bytecode: 0x7fc981fc81c8> +#> <bytecode: 0x7fca93340720> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/GetMultiExpr.html b/docs/reference/GetMultiExpr.html index 9ee1a27a..195face5 100644 --- a/docs/reference/GetMultiExpr.html +++ b/docs/reference/GetMultiExpr.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetNetworkData.html b/docs/reference/GetNetworkData.html index 6f0d3b40..30432b2b 100644 --- a/docs/reference/GetNetworkData.html +++ b/docs/reference/GetNetworkData.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetPFMList.html b/docs/reference/GetPFMList.html index 2501dac7..dfe931a4 100644 --- a/docs/reference/GetPFMList.html +++ b/docs/reference/GetPFMList.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -137,7 +137,7 @@

Examples

#> { #> seurat_obj@misc$motifs$pfm_list #> } -#> <bytecode: 0x7fc9697fa8d0> +#> <bytecode: 0x7fca78689d20> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/GetPowerTable.html b/docs/reference/GetPowerTable.html index deba0437..6dfaea2c 100644 --- a/docs/reference/GetPowerTable.html +++ b/docs/reference/GetPowerTable.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetTOM.html b/docs/reference/GetTOM.html index 416309b2..ca864457 100644 --- a/docs/reference/GetTOM.html +++ b/docs/reference/GetTOM.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetWGCNAGenes.html b/docs/reference/GetWGCNAGenes.html index 269c07b8..8958cfee 100644 --- a/docs/reference/GetWGCNAGenes.html +++ b/docs/reference/GetWGCNAGenes.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/GetWGCNAParams.html b/docs/reference/GetWGCNAParams.html index 9b700275..cd4dc4ff 100644 --- a/docs/reference/GetWGCNAParams.html +++ b/docs/reference/GetWGCNAParams.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/HubGeneNetworkPlot.html b/docs/reference/HubGeneNetworkPlot.html index 99e6297d..c0f1c488 100644 --- a/docs/reference/HubGeneNetworkPlot.html +++ b/docs/reference/HubGeneNetworkPlot.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -268,7 +268,7 @@

Examples

#> vertex.label.color = igraph::V(g)$fontcolor, vertex.label.cex = vertex.label.cex, #> ...) #> } -#> <bytecode: 0x7fc97c961260> +#> <bytecode: 0x7fcaad161218> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/MetacellsByGroups.html b/docs/reference/MetacellsByGroups.html index 6505e5d0..00c72278 100644 --- a/docs/reference/MetacellsByGroups.html +++ b/docs/reference/MetacellsByGroups.html @@ -18,7 +18,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/MetaspotsByGroups.html b/docs/reference/MetaspotsByGroups.html index fed2b602..2b0cb4fc 100644 --- a/docs/reference/MetaspotsByGroups.html +++ b/docs/reference/MetaspotsByGroups.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ModuleConnectivity.html b/docs/reference/ModuleConnectivity.html index 7bae1ce5..d26af188 100644 --- a/docs/reference/ModuleConnectivity.html +++ b/docs/reference/ModuleConnectivity.html @@ -18,7 +18,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ModuleCorrNetwork.html b/docs/reference/ModuleCorrNetwork.html index 557629aa..9bd943b8 100644 --- a/docs/reference/ModuleCorrNetwork.html +++ b/docs/reference/ModuleCorrNetwork.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -237,7 +237,7 @@

Examples

#> vertex.label.family = "Helvetica", vertex.label.color = "black", #> vertex.label.cex = 0.5, vertex.size = vertex_size) #> } -#> <bytecode: 0x7fc98394ccf8> +#> <bytecode: 0x7fca76247a38> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/ModuleCorrelogram.html b/docs/reference/ModuleCorrelogram.html index dfbdff60..6bcedb5a 100644 --- a/docs/reference/ModuleCorrelogram.html +++ b/docs/reference/ModuleCorrelogram.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ModuleEigengenes.html b/docs/reference/ModuleEigengenes.html index ee749638..64f36f65 100644 --- a/docs/reference/ModuleEigengenes.html +++ b/docs/reference/ModuleEigengenes.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ModuleExprScore.html b/docs/reference/ModuleExprScore.html index 26df6fbe..a4d7abe2 100644 --- a/docs/reference/ModuleExprScore.html +++ b/docs/reference/ModuleExprScore.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ModuleFeaturePlot.html b/docs/reference/ModuleFeaturePlot.html index ce596b15..d9eccbd3 100644 --- a/docs/reference/ModuleFeaturePlot.html +++ b/docs/reference/ModuleFeaturePlot.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -253,7 +253,7 @@

Examples

#> } #> p #> } -#> <bytecode: 0x7fc9915ff0c8> +#> <bytecode: 0x7fcaa4173a18> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/ModuleNetworkPlot.html b/docs/reference/ModuleNetworkPlot.html index e53f9b0c..0607c3f8 100644 --- a/docs/reference/ModuleNetworkPlot.html +++ b/docs/reference/ModuleNetworkPlot.html @@ -18,7 +18,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ModulePreservation.html b/docs/reference/ModulePreservation.html index 19823391..539a1436 100644 --- a/docs/reference/ModulePreservation.html +++ b/docs/reference/ModulePreservation.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -171,15 +171,11 @@

Examples

#> if (is.null(wgcna_name)) { #> wgcna_name <- seurat_obj@misc$active_wgcna #> } -#> if (!CheckWGCNAName(seurat_obj, wgcna_name)) { -#> stop(paste0("Invalid wgcna_name supplied: ", wgcna_name)) -#> } +#> CheckWGCNAName(seurat_obj, wgcna_name) #> if (is.null(wgcna_name_ref)) { #> wgcna_name_ref <- seurat_ref@misc$active_wgcna #> } -#> if (!CheckWGCNAName(seurat_ref, wgcna_name_ref)) { -#> stop(paste0("Invalid wgcna_name_ref supplied: ", wgcna_name_ref)) -#> } +#> CheckWGCNAName(seurat_ref, wgcna_name_ref) #> datExpr_ref <- GetDatExpr(seurat_ref, wgcna_name_ref) #> datExpr_query <- GetDatExpr(seurat_obj, wgcna_name) #> if (!is.null(gene_mapping)) { @@ -188,9 +184,14 @@

Examples

#> gene_mapping <- na.omit(gene_mapping[gene_match, ]) #> colnames(datExpr_query) <- gene_mapping[, genome1_col] #> } +#> genes_keep <- intersect(colnames(datExpr_ref), colnames(datExpr_query)) +#> datExpr_ref <- datExpr_ref[, genes_keep] +#> datExpr_query <- datExpr_query[, genes_keep] #> setLabels <- c("ref", "query") #> multiExpr <- list(ref = list(data = datExpr_ref), query = list(data = datExpr_query)) -#> ref_modules <- list(ref = GetModules(seurat_ref, wgcna_name = wgcna_name)$module) +#> ref_modules <- GetModules(seurat_ref, wgcna_name = wgcna_name_ref) +#> ref_modules <- ref_modules[genes_keep, ] +#> ref_modules <- list(ref = ref_modules$module) #> mp <- WGCNA::modulePreservation(multiExpr, ref_modules, referenceNetworks = 1, #> nPermutations = n_permutations, randomSeed = seed, quickCor = 0, #> parallelCalculation = parallel, ...) @@ -206,7 +207,7 @@

Examples

#> name, wgcna_name) #> seurat_obj #> } -#> <bytecode: 0x7fc97bb6aec8> +#> <bytecode: 0x7fca8c32a948> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/ModuleTFNetwork.html b/docs/reference/ModuleTFNetwork.html index cdaaf46f..739f99ba 100644 --- a/docs/reference/ModuleTFNetwork.html +++ b/docs/reference/ModuleTFNetwork.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -254,7 +254,7 @@

Examples

#> vertex.label.color = "black", vertex.label.cex = 0, vertex.frame.color = "black", #> margin = 0, edge.arrow.size = edge_df$value/2, add = TRUE) #> } -#> <bytecode: 0x7fc97f4998e8> +#> <bytecode: 0x7fcaad172ed0> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/ModuleTraitCorrelation.html b/docs/reference/ModuleTraitCorrelation.html index 41ed6891..b2c5a16e 100644 --- a/docs/reference/ModuleTraitCorrelation.html +++ b/docs/reference/ModuleTraitCorrelation.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -157,9 +157,7 @@

Examples

#> if (is.null(wgcna_name)) { #> wgcna_name <- seurat_obj@misc$active_wgcna #> } -#> if (!CheckWGCNAName(seurat_obj, wgcna_name)) { -#> stop(paste0("Invalid wgcna_name supplied: ", wgcna_name)) -#> } +#> CheckWGCNAName(seurat_obj, wgcna_name) #> if (features == "hMEs") { #> MEs <- GetMEs(seurat_obj, TRUE, wgcna_name) #> } @@ -296,7 +294,7 @@

Examples

#> } #> seurat_obj #> } -#> <bytecode: 0x7fc9803c35f8> +#> <bytecode: 0x7fca909e4610> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/ModuleUMAPPlot.html b/docs/reference/ModuleUMAPPlot.html index a63fff87..b4ee30dc 100644 --- a/docs/reference/ModuleUMAPPlot.html +++ b/docs/reference/ModuleUMAPPlot.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -271,7 +271,7 @@

Examples

#> vertex.label.cex = 0, vertex.frame.color = igraph::V(g)$framecolor, #> margin = 0) #> } -#> <bytecode: 0x7fc9832397f8> +#> <bytecode: 0x7fca938b89c8> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/MotifOverlapBarPlot.html b/docs/reference/MotifOverlapBarPlot.html index aa2a9b73..174ea66c 100644 --- a/docs/reference/MotifOverlapBarPlot.html +++ b/docs/reference/MotifOverlapBarPlot.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -194,7 +194,7 @@

Examples

#> dev.off() #> } #> } -#> <bytecode: 0x7fc965e93a40> +#> <bytecode: 0x7fca76014d68> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/MotifScan.html b/docs/reference/MotifScan.html index 6a7d8cdc..8502264e 100644 --- a/docs/reference/MotifScan.html +++ b/docs/reference/MotifScan.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -185,7 +185,7 @@

Examples

#> seurat_obj <- SetPFMList(seurat_obj, pfm) #> seurat_obj #> } -#> <bytecode: 0x7fc9674c4e68> +#> <bytecode: 0x7fca775a2720> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/MotifTargetScore.html b/docs/reference/MotifTargetScore.html index 0a153778..0195ca0f 100644 --- a/docs/reference/MotifTargetScore.html +++ b/docs/reference/MotifTargetScore.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/NormalizeMetacells.html b/docs/reference/NormalizeMetacells.html index 4fd2651f..916f1600 100644 --- a/docs/reference/NormalizeMetacells.html +++ b/docs/reference/NormalizeMetacells.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/OverlapBarPlot.html b/docs/reference/OverlapBarPlot.html index adbc170c..c37423e2 100644 --- a/docs/reference/OverlapBarPlot.html +++ b/docs/reference/OverlapBarPlot.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -188,7 +188,7 @@

Examples

#> } #> plot_list #> } -#> <bytecode: 0x7fc993dc5190> +#> <bytecode: 0x7fcab2642aa0> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/OverlapDotPlot.html b/docs/reference/OverlapDotPlot.html index cd6577f2..1f308054 100644 --- a/docs/reference/OverlapDotPlot.html +++ b/docs/reference/OverlapDotPlot.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -172,7 +172,7 @@

Examples

#> } #> p #> } -#> <bytecode: 0x7fc98bf445f8> +#> <bytecode: 0x7fca9c4aea20> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/OverlapModulesDEGs.html b/docs/reference/OverlapModulesDEGs.html index ff2a83c5..44fed20a 100644 --- a/docs/reference/OverlapModulesDEGs.html +++ b/docs/reference/OverlapModulesDEGs.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/OverlapModulesMotifs.html b/docs/reference/OverlapModulesMotifs.html index 6b1d6614..1ff1209d 100644 --- a/docs/reference/OverlapModulesMotifs.html +++ b/docs/reference/OverlapModulesMotifs.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -186,7 +186,7 @@

Examples

#> size_intersection)) #> overlap_df #> } -#> <bytecode: 0x7fc97e501258> +#> <bytecode: 0x7fca8e9fc318> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/PlotDMEsLollipop.html b/docs/reference/PlotDMEsLollipop.html index a0e90848..1b94db68 100644 --- a/docs/reference/PlotDMEsLollipop.html +++ b/docs/reference/PlotDMEsLollipop.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/PlotDMEsVolcano.html b/docs/reference/PlotDMEsVolcano.html index b8ebdfd4..709f01aa 100644 --- a/docs/reference/PlotDMEsVolcano.html +++ b/docs/reference/PlotDMEsVolcano.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -205,7 +205,7 @@

Examples

#> NoLegend() #> p + NoLegend() #> } -#> <bytecode: 0x7fc981205ae0> +#> <bytecode: 0x7fca91c9ed78> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/PlotDendrogram.html b/docs/reference/PlotDendrogram.html index bce14ca6..d4a05875 100644 --- a/docs/reference/PlotDendrogram.html +++ b/docs/reference/PlotDendrogram.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -157,7 +157,7 @@

Examples

#> hang = hang, addGuide = addGuide, guideHang = guideHang, #> main = main, ...) #> } -#> <bytecode: 0x7fc9654697b0> +#> <bytecode: 0x7fca942e2128> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/PlotKMEs.html b/docs/reference/PlotKMEs.html index e5a553b0..469a7f59 100644 --- a/docs/reference/PlotKMEs.html +++ b/docs/reference/PlotKMEs.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -196,7 +196,7 @@

Examples

#> }) #> wrap_plots(plot_list, ncol = ncol) #> } -#> <bytecode: 0x7fc965797200> +#> <bytecode: 0x7fca76cdfa88> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/PlotLollipop.html b/docs/reference/PlotLollipop.html index 1b07e52f..9427a556 100644 --- a/docs/reference/PlotLollipop.html +++ b/docs/reference/PlotLollipop.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/PlotModulePreservation.html b/docs/reference/PlotModulePreservation.html index 0fe1558a..87cf1db7 100644 --- a/docs/reference/PlotModulePreservation.html +++ b/docs/reference/PlotModulePreservation.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -228,7 +228,7 @@

Examples

#> } #> plot_list #> } -#> <bytecode: 0x7fc96b0cd270> +#> <bytecode: 0x7fca79e59540> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/PlotModuleTraitCorrelation.html b/docs/reference/PlotModuleTraitCorrelation.html index ff2ce04f..178a10ed 100644 --- a/docs/reference/PlotModuleTraitCorrelation.html +++ b/docs/reference/PlotModuleTraitCorrelation.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -241,7 +241,7 @@

Examples

#> } #> plot_list #> } -#> <bytecode: 0x7fc96b0cd270> +#> <bytecode: 0x7fca79e59540> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/PlotModuleTrajectory.html b/docs/reference/PlotModuleTrajectory.html index afdd2091..25f11ada 100644 --- a/docs/reference/PlotModuleTrajectory.html +++ b/docs/reference/PlotModuleTrajectory.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/PlotSoftPowers.html b/docs/reference/PlotSoftPowers.html index e2cf8682..197e8493 100644 --- a/docs/reference/PlotSoftPowers.html +++ b/docs/reference/PlotSoftPowers.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -253,7 +253,7 @@

Examples

#> } #> plot_list #> } -#> <bytecode: 0x7fc979cb3d48> +#> <bytecode: 0x7fca89438398> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/ProjectModules.html b/docs/reference/ProjectModules.html index 5e297982..bb98f87e 100644 --- a/docs/reference/ProjectModules.html +++ b/docs/reference/ProjectModules.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -177,6 +177,7 @@

Examples

#> if (is.null(wgcna_name)) { #> wgcna_name <- seurat_ref@misc$active_wgcna #> } +#> CheckWGCNAName(seurat_ref, wgcna_name) #> if (is.null(modules)) { #> modules <- GetModules(seurat_ref, wgcna_name) #> } @@ -218,7 +219,7 @@

Examples

#> ...) #> seurat_obj #> } -#> <bytecode: 0x7fc97e24e3c8> +#> <bytecode: 0x7fca8e9af4a8> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/ReassignModules.html b/docs/reference/ReassignModules.html index 141167f1..e1117391 100644 --- a/docs/reference/ReassignModules.html +++ b/docs/reference/ReassignModules.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ResetModuleColors.html b/docs/reference/ResetModuleColors.html index 38ee2052..705b7c6d 100644 --- a/docs/reference/ResetModuleColors.html +++ b/docs/reference/ResetModuleColors.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ResetModuleNames.html b/docs/reference/ResetModuleNames.html index 9dacbb27..25051041 100644 --- a/docs/reference/ResetModuleNames.html +++ b/docs/reference/ResetModuleNames.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/RunEnrichr.html b/docs/reference/RunEnrichr.html index 9a6bf33e..b62a6f5d 100644 --- a/docs/reference/RunEnrichr.html +++ b/docs/reference/RunEnrichr.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/RunHarmonyMetacells.html b/docs/reference/RunHarmonyMetacells.html index ca37985d..988abb68 100644 --- a/docs/reference/RunHarmonyMetacells.html +++ b/docs/reference/RunHarmonyMetacells.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/RunModuleUMAP.html b/docs/reference/RunModuleUMAP.html index 138bd84b..36cdb98e 100644 --- a/docs/reference/RunModuleUMAP.html +++ b/docs/reference/RunModuleUMAP.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/RunPCAMetacells.html b/docs/reference/RunPCAMetacells.html index b8da7e06..8e26b988 100644 --- a/docs/reference/RunPCAMetacells.html +++ b/docs/reference/RunPCAMetacells.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/RunUMAPMetacells.html b/docs/reference/RunUMAPMetacells.html index 6440b90b..513e3c24 100644 --- a/docs/reference/RunUMAPMetacells.html +++ b/docs/reference/RunUMAPMetacells.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/ScaleMetacells.html b/docs/reference/ScaleMetacells.html index b101804a..e7eef094 100644 --- a/docs/reference/ScaleMetacells.html +++ b/docs/reference/ScaleMetacells.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SelectNetworkGenes.html b/docs/reference/SelectNetworkGenes.html index cc0f80f5..cf74b63d 100644 --- a/docs/reference/SelectNetworkGenes.html +++ b/docs/reference/SelectNetworkGenes.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetActiveWGCNA.html b/docs/reference/SetActiveWGCNA.html index 8c9201bb..a87f3e21 100644 --- a/docs/reference/SetActiveWGCNA.html +++ b/docs/reference/SetActiveWGCNA.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetAvgModuleExpr.html b/docs/reference/SetAvgModuleExpr.html index 6ea0ee06..f2a4b8a0 100644 --- a/docs/reference/SetAvgModuleExpr.html +++ b/docs/reference/SetAvgModuleExpr.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetDatExpr.html b/docs/reference/SetDatExpr.html index cb9577a7..1a083988 100644 --- a/docs/reference/SetDatExpr.html +++ b/docs/reference/SetDatExpr.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetEnrichrTable.html b/docs/reference/SetEnrichrTable.html index e5d22ee2..107e601a 100644 --- a/docs/reference/SetEnrichrTable.html +++ b/docs/reference/SetEnrichrTable.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetMELoadings.html b/docs/reference/SetMELoadings.html index 8414f074..72978b5b 100644 --- a/docs/reference/SetMELoadings.html +++ b/docs/reference/SetMELoadings.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetMEs.html b/docs/reference/SetMEs.html index c8fd5150..e542e761 100644 --- a/docs/reference/SetMEs.html +++ b/docs/reference/SetMEs.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetMetacellObject.html b/docs/reference/SetMetacellObject.html index 02206a81..666da83b 100644 --- a/docs/reference/SetMetacellObject.html +++ b/docs/reference/SetMetacellObject.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetModulePreservation.html b/docs/reference/SetModulePreservation.html index 91d146ba..0b15b913 100644 --- a/docs/reference/SetModulePreservation.html +++ b/docs/reference/SetModulePreservation.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetModuleScores.html b/docs/reference/SetModuleScores.html index 62db80b1..c7a7978c 100644 --- a/docs/reference/SetModuleScores.html +++ b/docs/reference/SetModuleScores.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetModuleTraitCorrelation.html b/docs/reference/SetModuleTraitCorrelation.html index 5b274a52..dfd338e1 100644 --- a/docs/reference/SetModuleTraitCorrelation.html +++ b/docs/reference/SetModuleTraitCorrelation.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetModuleUMAP.html b/docs/reference/SetModuleUMAP.html index 347e2758..664ed0c7 100644 --- a/docs/reference/SetModuleUMAP.html +++ b/docs/reference/SetModuleUMAP.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetModules.html b/docs/reference/SetModules.html index ce3518b9..6ebab94e 100644 --- a/docs/reference/SetModules.html +++ b/docs/reference/SetModules.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetMotifMatrix.html b/docs/reference/SetMotifMatrix.html index ae6d2731..f558d75e 100644 --- a/docs/reference/SetMotifMatrix.html +++ b/docs/reference/SetMotifMatrix.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -143,7 +143,7 @@

Examples

#> seurat_obj@misc$motifs$tf_match_matrix <- tf_match #> seurat_obj #> } -#> <bytecode: 0x7fc97f65ee30> +#> <bytecode: 0x7fca902e7c40> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/SetMotifOverlap.html b/docs/reference/SetMotifOverlap.html index 94a3a24a..f020a48b 100644 --- a/docs/reference/SetMotifOverlap.html +++ b/docs/reference/SetMotifOverlap.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetMotifScores.html b/docs/reference/SetMotifScores.html index 57bc3cf8..a62c89ea 100644 --- a/docs/reference/SetMotifScores.html +++ b/docs/reference/SetMotifScores.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetMotifTargets.html b/docs/reference/SetMotifTargets.html index 564b2140..ffefbd74 100644 --- a/docs/reference/SetMotifTargets.html +++ b/docs/reference/SetMotifTargets.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -143,7 +143,7 @@

Examples

#> seurat_obj@misc$motifs$motif_targets <- motif_targets #> seurat_obj #> } -#> <bytecode: 0x7fc965b03518> +#> <bytecode: 0x7fca94dae340> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/SetMotifs.html b/docs/reference/SetMotifs.html index d3c008d4..91a34b41 100644 --- a/docs/reference/SetMotifs.html +++ b/docs/reference/SetMotifs.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -143,7 +143,7 @@

Examples

#> seurat_obj@misc$motifs$motif_df <- motif_df #> seurat_obj #> } -#> <bytecode: 0x7fc966673630> +#> <bytecode: 0x7fca781847d0> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/SetMultiExpr.html b/docs/reference/SetMultiExpr.html index 3bfe1988..8bebb5c3 100644 --- a/docs/reference/SetMultiExpr.html +++ b/docs/reference/SetMultiExpr.html @@ -18,7 +18,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetNetworkData.html b/docs/reference/SetNetworkData.html index 7d32d85b..2389c244 100644 --- a/docs/reference/SetNetworkData.html +++ b/docs/reference/SetNetworkData.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetPFMList.html b/docs/reference/SetPFMList.html index b8490619..6189c4f8 100644 --- a/docs/reference/SetPFMList.html +++ b/docs/reference/SetPFMList.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -143,7 +143,7 @@

Examples

#> seurat_obj@misc$motifs$pfm_list <- pfm_list #> seurat_obj #> } -#> <bytecode: 0x7fc9a16fae08> +#> <bytecode: 0x7fcaad08aa20> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/SetPowerTable.html b/docs/reference/SetPowerTable.html index 29392d30..473f4012 100644 --- a/docs/reference/SetPowerTable.html +++ b/docs/reference/SetPowerTable.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetWGCNAGenes.html b/docs/reference/SetWGCNAGenes.html index 3ef1e9fa..17f9a7fb 100644 --- a/docs/reference/SetWGCNAGenes.html +++ b/docs/reference/SetWGCNAGenes.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetWGCNAParams.html b/docs/reference/SetWGCNAParams.html index 8f9db6f1..0b790ba2 100644 --- a/docs/reference/SetWGCNAParams.html +++ b/docs/reference/SetWGCNAParams.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/SetupForWGCNA.html b/docs/reference/SetupForWGCNA.html index 50e4d962..1b539c06 100644 --- a/docs/reference/SetupForWGCNA.html +++ b/docs/reference/SetupForWGCNA.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/TestSoftPowers.html b/docs/reference/TestSoftPowers.html index 0476cac5..a52c64dd 100644 --- a/docs/reference/TestSoftPowers.html +++ b/docs/reference/TestSoftPowers.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/TestSoftPowersConsensus.html b/docs/reference/TestSoftPowersConsensus.html index e9ada10a..7e4678b3 100644 --- a/docs/reference/TestSoftPowersConsensus.html +++ b/docs/reference/TestSoftPowersConsensus.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/TransferModuleGenome.html b/docs/reference/TransferModuleGenome.html index 33694a3e..3dfe3d53 100644 --- a/docs/reference/TransferModuleGenome.html +++ b/docs/reference/TransferModuleGenome.html @@ -18,7 +18,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -170,7 +170,7 @@

Examples

#> rownames(modules) <- modules$gene_name #> modules #> } -#> <bytecode: 0x7fc983606658> +#> <bytecode: 0x7fca76b18748> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/check_inputs.html b/docs/reference/check_inputs.html index fb08e7cb..8d284e8e 100644 --- a/docs/reference/check_inputs.html +++ b/docs/reference/check_inputs.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/corSparse.html b/docs/reference/corSparse.html index 63afd7bb..18487de3 100644 --- a/docs/reference/corSparse.html +++ b/docs/reference/corSparse.html @@ -18,7 +18,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/index.html b/docs/reference/index.html index 0430b1c9..d823acea 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/scale01.html b/docs/reference/scale01.html index aaab8c32..9b57e8bf 100644 --- a/docs/reference/scale01.html +++ b/docs/reference/scale01.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -139,7 +139,7 @@

Examples

#> z <- max(x) #> (x - y)/(z - y) #> } -#> <bytecode: 0x7fc97a28e278> +#> <bytecode: 0x7fca89be2ab0> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/shuffle_points.html b/docs/reference/shuffle_points.html index e4e3bad2..d9b6ee22 100644 --- a/docs/reference/shuffle_points.html +++ b/docs/reference/shuffle_points.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -137,7 +137,7 @@

Examples

#> { #> return(df[sample(1:dim(df)[1], dim(df)[1]), ]) #> } -#> <bytecode: 0x7fc992592f28> +#> <bytecode: 0x7fcaa0401498> #> <environment: namespace:hdWGCNA> diff --git a/docs/reference/to_pseudobulk.html b/docs/reference/to_pseudobulk.html index 544c637f..d1cec64b 100644 --- a/docs/reference/to_pseudobulk.html +++ b/docs/reference/to_pseudobulk.html @@ -19,7 +19,7 @@ hdWGCNA - 0.3.00 + 0.3.01 diff --git a/docs/reference/umap_theme.html b/docs/reference/umap_theme.html index f6aa5337..d65dec23 100644 --- a/docs/reference/umap_theme.html +++ b/docs/reference/umap_theme.html @@ -17,7 +17,7 @@ hdWGCNA - 0.3.00 + 0.3.01 @@ -137,7 +137,7 @@

Examples

#> panel.grid.major = element_blank(), panel.grid.minor = element_blank(), #> plot.background = element_blank(), plot.title = element_text(hjust = 0.5)) #> } -#> <bytecode: 0x7fc97d3fc488> +#> <bytecode: 0x7fca8daab700> #> <environment: namespace:hdWGCNA> diff --git a/inst/pkgdown.yml b/inst/pkgdown.yml index 82b99b33..4fa2fd6b 100644 --- a/inst/pkgdown.yml +++ b/inst/pkgdown.yml @@ -20,7 +20,7 @@ articles: pseudobulk: pseudobulk.html pseudotime: pseudotime.html sctransform: sctransform.html -last_built: 2024-02-28T06:02Z +last_built: 2024-03-08T02:39Z urls: reference: https://smorabit.github.io/hdWGCNA/reference article: https://smorabit.github.io/hdWGCNA/articles diff --git a/vignettes/module_preservation.Rmd b/vignettes/module_preservation.Rmd index c7a9edb9..a870431f 100644 --- a/vignettes/module_preservation.Rmd +++ b/vignettes/module_preservation.Rmd @@ -10,17 +10,20 @@ vignette: > --- -Data-driven models are thought to be useful when they are generalizable across -different datasets. If we think about co-expression networks from this perspective, -we need a way to statistically quantify the conservation of co-expression modules -that were identified in one datasets across external datasets. This is a common theme -in machine learning, where a model is learned on a training dataset but evaluated -using an external validation dataset. - -In the [previous tutorial](projecting_modules.html), we projected the co-expression -modules from a reference to a query dataset, but we did not quantify the degree -to which these modules were preserved across datasets. In this tutorial, we perform statistical tests to estimate the conservation of -projected modules. +Compiled: 07-03-2024 + +Source: `vignettes/basic_tutorial.Rmd` + + +Data-driven models are most useful when they are generalizable across +different datasets. Thinking about co-expression networks from this perspective, +we need a way to quantify and test the conservation of co-expression patterns +identified in one dataset across external datasets. In this tutorial, we +demonstrate **module preservation analysis** with hdWGCNA, a statistical +framewoerk that allows us to test the degree to which co-expression modules identified in +one dataset are "preserved" in another dataset. This tutorial builds off of +a [previous tutorial](projecting_modules.html), where we projected the co-expression +modules from a reference dataset to a query dataset. First we must load the data and the required libraries: ```{r eval=FALSE} @@ -57,8 +60,9 @@ seurat_query <- readRDS(file=paste0(data_dir, 'Morabito_Miyoshi_2021_control.rds ## Module preservation analysis In their 2011 paper titled -["Is My Network Module Preserved and Reproducible?"](https://doi.org/10.1371/journal.pcbi.1001057), Langfelder et al discuss statistical methods for -module preservation analysis in co-expression network analysis. Notably, module preservation analysis can be used +["Is My Network Module Preserved and Reproducible?"](https://doi.org/10.1371/journal.pcbi.1001057), +Langfelder et al discuss statistical methods for module preservation analysis in co-expression network +analysis. Notably, module preservation analysis can be used to assess the reproducibility of co-expression networks, but it can also be used for specific biological analyses, for example to identify which modules are significantly preserved across different disease conditions, tissues, developmental @@ -71,8 +75,8 @@ The first step in module preservation analysis is to project modules from a refe seurat_query <- ProjectModules( seurat_obj = seurat_query, seurat_ref = seurat_ref, - wgcna_name = "INH", - wgcna_name_proj="INH_projected", + wgcna_name = "tutorial", + wgcna_name_proj="projected", assay="RNA" # assay for query dataset ) @@ -81,44 +85,37 @@ seurat_query <- ProjectModules( Next, we set up the expression matrices for the query and reference datasets. Either the single-cell or the metacell gene expression matrices can be used here by setting the `use_metacells` flag in `SetDatExpr`. In general we recommend using the same matrix that was used to construct the network -for the reference (in this case, the metacell matrix). - +for the reference (in this case, the metacell matrix). If you have not already constructed +metacells in the query dataset, you can do that prior to module preservation analysis. +
See code to consruct metacells in the query dataset ```{r eval=FALSE} -# set expression matrix for reference dataset -seurat_ref <- SetDatExpr( - seurat_ref, - group_name = "INH", - group.by = "cell_type" +# construct metacells: +seurat_query <- MetacellsByGroups( + seurat_obj = seurat_query, + group.by = c("cell_type", "Sample"), + k = 25, + max_shared = 12, + reduction = 'harmony', + ident.group = 'cell_type' ) +seurat_query <- NormalizeMetacells(seurat_query) -# set expression matrix for query dataset: -seurat_query <- SetDatExpr( - seurat_query, - group_name = "INH", - group.by = "cell_type", - use_metacells = FALSE -) ``` +
-
** Using the metacell expression matrix for the query dataset ** -If you choose to use the metacell expression matrix for the query dataset, you have to first run `MetacellsByGroups` on the query dataset. ```{r eval=FALSE} -# compute metacells -seurat_query <- MetacellsByGroups( - seurat_obj = seurat_query, - group.by = c("cell_type", "Sample"), - reduction = 'harmony', - k = 25, - max_shared = 10, - ident.group = 'cell_type' +# set expression matrix for reference dataset +seurat_ref <- SetDatExpr( + seurat_ref, + group_name = "INH", + group.by = "cell_type" ) -seurat_query <- NormalizeMetacells(seurat_query) # set expression matrix for query dataset: seurat_query <- SetDatExpr( @@ -129,9 +126,15 @@ seurat_query <- SetDatExpr( ``` -
+Now we can run the `ModulePreservation` function. Note that this +function does take a while to run since it is a permutation test, +but it can be sped up by lowering the `n_permutations` parameter, +but we do not recommend any lower than 100 permutations. Also note +that the `parallel` option currently does not work. For demonstration purposes, we ran the code for this tutorial using +only 20 permutations so it would run quickly. -Now we can run the `ModulePreservation` function. Note that this function does take a while to run since it is permutation based, but it can be sped up by lowering the `n_permutations` parameter, but we do not recommend any lower than 100 permutations. Also note that the `parallel` option currently does not work. +`ModulePreservation` takes a `name` parameter, which is used to store +the results of this module perturbation test. ```{r eval=FALSE} @@ -141,29 +144,40 @@ seurat_query <- ModulePreservation( seurat_ref = seurat_ref, name="Zhou-INH", verbose=3, - n_permutations=250 + n_permutations=250 # n_permutations=20 used for the tutorial ) -# getthe module preservation table -mod_pres <- GetModulePreservation(seurat_query, "Zhou-INH")$Z -obs_df <- GetModulePreservation(seurat_query, "Zhou-INH")$obs - -grep('summary', colnames(mod_pres)) -grep('summary', colnames(obs)) ``` -Please consult [this tutorial](https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/ModulePreservation/Tutorials/) + ## Visualize preservation stats -In this section, we use the function `PlotModulePreservation` to visualize the +The module perturbation test produces a number of different preservation statistics, which you +can inspect in the following tables. + +```{r eval=FALSE} +# get the module preservation table +mod_pres <- GetModulePreservation(seurat_query, "Zhou-INH")$Z +obs_df <- GetModulePreservation(seurat_query, "Zhou-INH")$obs +``` + +In the past we linked to the original WGCNA documentation website for +more detailed explanations of thes statistics, but unfortunately at the +time of writing this tutorial the website has been taken offline. +Please refer to the original publication in [PLOS Computational Biology](https://doi.org/10.1371/journal.pcbi.1001057) +for further explanations. + +hdWGCNA includes the function `PlotModulePreservation` to visualize the statistics we computed in the previous section. This function generates a scatter -plot showing the module size versus the module preservation stats. +plot showing the module size versus the module preservation stats. The summary +statistics aggregate the individual preservation and quality statistics into a single metric +so we generally recommend primarily interpreting the results with these plots. ```{r eval=FALSE} @@ -180,7 +194,15 @@ wrap_plots(plot_list, ncol=2) -Plot the ranking stats +Here we can see three different shades in the background. These represent +cutoff values for interpreting the Z summary statistics. The following +guidelines help us understand the preservation of these modules. + +* Z > 2, the module is not preserved in the query dataset. +* 10 > Z > 2, the module is moderately preserved in the query dataset. +* Z > 10, the module is highly preserved in the query dataset. + +The following code shows how to plot additional module preservation stats. ```{r eval=FALSE} @@ -192,12 +214,18 @@ plot_list <- PlotModulePreservation( ) +wrap_plots(plot_list, ncol=2) + +``` + +```{r eval=FALSE, echo=FALSE} png(paste0(fig_dir, 'module_preservation_rank.png'), width=10, height=10, res=400, units='in') wrap_plots(plot_list, ncol=2) dev.off() ``` + diff --git a/vignettes/projecting_modules.Rmd b/vignettes/projecting_modules.Rmd index 5abf1b7f..f4d56c6b 100644 --- a/vignettes/projecting_modules.Rmd +++ b/vignettes/projecting_modules.Rmd @@ -9,16 +9,22 @@ vignette: > %\VignetteEncoding{UTF-8} --- -In this tutorial, we begin to analyze the co-expresion modules detected in one +Compiled: 07-03-2024 + +Source: `vignettes/basic_tutorial.Rmd` + +In this tutorial, we show how to investigate co-expresion modules detected in one dataset in external datasets. Rather than building a new co-expression network from scratch in a new dataset, we can take the modules from one dataset and project -them into the new dataset. Before starting this tutorial, make sure that you -have constructed the co-expression network as in the [hdWGCNA basics](articles/basics_tutorial.html). The main hdWGCNA tutorials have been using the control +them into the new dataset. A prerequisite for this tutorial is constructing a +co-expression network in a single-cell or spatial transcritpomic dataset, +see the [single-cell basics](articles/basics_tutorial.html) or the [spatial basics](articles/ST_basics.html) +tutorial before proceeding. The main hdWGCNA tutorials have been using the control brain samples from [this publication](https://www.nature.com/articles/s41591-019-0695-9), and now we will project the inhibitory neruon modules from Zhou et al into the -control brain samples from [Morabito and Miyoshi 2021](https://doi.org/10.1038/s41588-021-00894-z). +control brain snRNA-seq dataset from [Morabito and Miyoshi 2021](https://doi.org/10.1038/s41588-021-00894-z). -First we must load the data and the required libraries: +First we load the datasets and the required libraries: ```{r eval=FALSE} # single-cell analysis package @@ -56,7 +62,7 @@ In this section we project the modules from the Zhou et al inhibitory neuron hdWGCNA experiment into the Morabito & Miyoshi et al control brain dataset. We refer to the Zhou et al dataset as the "reference" dataset, and the Morabito & Miyoshi et al dataset as the "query" dataset. Just [as we had done before](basic_tutorial.html) when building the co-expression network from scratch, the basic single-cell pipeline -has to be 0done on the query dataset (normalization, scaling, variable features, PCA, batch correction, UMAP, clustering). +has to be done on the query dataset (normalization, scaling, variable features, PCA, batch correction, UMAP, clustering). First we make a UMAP plot to visualize the two datasets to ensure they have both been processed. @@ -101,7 +107,7 @@ seurat_query <- ProjectModules( seurat_ref = seurat_ref, # vars.to.regress = c(), # optionally regress covariates when running ScaleData group.by.vars = "Batch", # column in seurat_query to run harmony on - wgcna_name_proj="Zhou_projected", # name of the new hdWGCNA experiment in the query dataset + wgcna_name_proj="projected", # name of the new hdWGCNA experiment in the query dataset wgcna_name = "tutorial" # name of the hdWGCNA experiment in the ref dataset ) @@ -116,21 +122,22 @@ the *kME* values in the module assignment table `GetModules(seurat_query)` are t ```{r eval=FALSE} -# compute module hub gene expression scores for projected modules: -seurat_query <- ModuleExprScore( + +seurat_query <- ModuleConnectivity( seurat_query, - n_genes = 25, - method='Seurat' + group.by = 'cell_type', group_name = 'INH' ) -# compute intramodular connectivity -seurat_query <- ModuleConnectivity(seurat_query, assay="RNA", slot="data") +seurat_query <- ModuleExprScore( + seurat_query, + method='UCell' +) ``` -Save the query Seurat object after projecting modules. +```{r eval=FALSE, echo=FALSE} +# Save the query Seurat object after projecting modules. -```{r eval=FALSE} saveRDS(seurat_query, file=paste0(data_dir, 'Morabito_Miyoshi_2021_control.rds')) seurat_query <- readRDS(paste0(data_dir, 'Swarup2021_control_hdWGCNA_modpres.rds')) @@ -164,7 +171,8 @@ function to visualizes the hMEs on the UMAP: plot_list <- ModuleFeaturePlot( seurat_query, features='hMEs', - order=TRUE + order=TRUE, + restrict_range=FALSE ) # stitch together with patchwork @@ -178,19 +186,19 @@ Next we will make a dot plot for each of the modules grouped by cell type identi ```{r eval=FALSE} -# get the projected hMEs -projected_hMEs <- GetMEs(seurat_query, harmonized=TRUE) +# get the projected MEs +projected_MEs <- GetMEs(seurat_query) -# add hMEs to Seurat meta-data: +# add MEs to Seurat meta-data: seurat_query@meta.data <- cbind( seurat_query@meta.data, - projected_hMEs + projected_MEs ) # plot with Seurat's DotPlot function p <- DotPlot( seurat_query, - features = colnames(projected_hMEs), + features = colnames(projected_MEs), group.by = 'cell_type' )