```{r diffcoexp_conditional_block_head, eval=grepl("X", opt$modules), echo=FALSE, results='asis'}
cat("### **diffcoexp Results**

The package diffcoexp looks for genes that are coexpressed with different sets genes for case and control samples respectively, i.e. differentially co-expressed

The following plot shows the ratio of differentially co-expressed links (DCLs) to the total number of co-expressed links for each gene for which at least one DCL is available:")
```

```{r diffcoexp_conditional_block_plot, eval=grepl("X", opt$modules), echo=FALSE, warning=FALSE, message=FALSE}
DCGs <- results_diffcoexp$DCGs
DCG_plot_df <-data.frame(DCG_ratio = DCGs$DCLs/DCGs$CLs, 
                mean_logFCs = DE_all_genes[DCGs$Gene,"mean_logFCs"],
                DCG_qval = DCGs$q,
                combined_FDR = DE_all_genes[DCGs$Gene,"combined_FDR"])

# Use these to vary signficance according to DCG and combiend FDR for DE
DCG_plot_df$DCG_sig <- ifelse(DCG_plot_df$DCG_qval < 0.05, "sig", "not_sig")
DCG_plot_df$DE_sig <- ifelse(DCG_plot_df$combined_FDR < 0.05, "sig", "not_sig")
ggplot2::ggplot(DCG_plot_df, ggplot2::aes(x=DCG_ratio, y=mean_logFCs, colour=DCG_sig, shape=DE_sig)) + ggplot2::geom_point()

```

