diff aurora_wgcna_trait.Rmd @ 11:01ace2c8a593 draft

Uploaded
author spficklin
date Fri, 22 Nov 2019 01:47:07 +0000
parents ffbafe466107
children 3ed8495d7df7
line wrap: on
line diff
--- a/aurora_wgcna_trait.Rmd	Fri Nov 22 01:46:52 2019 +0000
+++ b/aurora_wgcna_trait.Rmd	Fri Nov 22 01:47:07 2019 +0000
@@ -7,7 +7,7 @@
 ---
 
 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
-knitr::opts_chunk$set(error = TRUE, echo = FALSE)
+knitr::opts_chunk$set(error = FALSE, echo = FALSE)
 ```
 ```{r}
 # Load the data from the previous step.
@@ -57,13 +57,17 @@
 
 datatable(trait_data)
 ```
-# Module-Condition Association.
+# Module-Condition Association
+
 Now that we have trait/phenotype data, we can explore if any of the network modules are asociated with these features. First, is an empirical exploration by viewing again the sample dendrogram but with traits added and colored by category or numerical intensity, as appropriate. If groups of samples with similar expression also share similar annotations then the same colors will appear "in blocks" under the clustered samples.  This view does not indicate associations but can help visualize when some modules might be associated.
 
 ```{r fig.align='center', fig.width=8, fig.height=9}
 
 # Determine the column types within the trait annotation data.
 trait_types = sapply(trait_data, class)
+
+# So that we can merge colors together with a cbind, create a
+# data frame with an empty column
 trait_colors = data.frame(empty = rep(1:dim(trait_data)[1]))
 
 # Set the colors for the quantitative data.
@@ -93,6 +97,8 @@
     trait_colors = cbind(trait_colors, ordinal_colors)
 }
 
+# Remove the empty column from teh trait_colors dataframe and
+# reorder the colors to match the same order of columns in the trait_data df.
 trait_colors = subset(trait_colors, select=-c(empty))
 trait_colors = trait_colors[,colnames(trait_data)]
 options(repr.plot.width=15, repr.plot.height=10)