-
Notifications
You must be signed in to change notification settings - Fork 0
/
05-infected-vs-uninfected.Rmd
142 lines (112 loc) · 3.37 KB
/
05-infected-vs-uninfected.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
---
author: "V. Keith Hughitt"
date: "`r format(Sys.time(), '%d %B, %Y')`"
params:
settings: ""
title: ""
version: ""
analysis_dirname: "05-infected-vs-uninfected"
title: "`r params$title` (`r params$version`)"
output:
html_document:
toc: true
number_sections: true
pdf_document:
toc: true
number_sections: true
latex_engine: xelatex
---
### Setup
```{r load_libraries, message=FALSE}
library(biomaRt)
library(doParallel)
library(dynamicTreeCut)
library(flashClust)
library(foreach)
library(goseq)
library(gplots)
library(gridExtra)
library(hpgltools)
library(igraph)
library(knitr)
library(knitcitations)
library(reshape2)
library(rJava)
library(preprocessCore)
library(tools)
library(viridis)
library(xlsx)
library(tidyverse)
source('../../2015/00-shared/R/annotations.R')
source('../../2015/00-shared/R/count_tables.R')
source('../../2015/00-shared/R/enrichment_analysis.R')
source('../../2015/00-shared/R/plots.R')
source('../../2015/00-shared/R/util.R')
source('../../2015/00-shared/R/wgcna.R')
```
```{r child='child/00-shared-setup.Rmd'}
```
```{r child='child/05-infected-vs-uninfected-load-counts.Rmd'}
```
```{r child='../../2015/00-shared/Rmd/init/load_host_annotations.Rmd'}
```
```{r}
# update figure prefix
opts_chunk$set(fig.path=paste0(output_figprefix,
paste0(MANUSCRIPT_CONFIG$output_suffix, '-')))
options(digits=4)
# keep a backup of full annotation dataframe
gene_info_orig <- gene_info
```
### Load host consensus networks
```{r load_host_nets}
load(MANUSCRIPT_CONFIG$adjmat_inf)
inf <- adjmat
load(MANUSCRIPT_CONFIG$adjmat_uninf)
uninf <- adjmat
```
### Construct difference network
```{r}
mapping_inf <- CONFIG_INF$condition_mapping
mapping_uninf <- CONFIG_UNINF$condition_mapping
condition_inf <- factor(CONFIG_INF$samples[['Condition']])
condition_uninf <- factor(CONFIG_UNINF$samples[['Condition']])
subtitle <- MANUSCRIPT_CONFIG[['subtitle']]
# update figure prefix
opts_chunk$set(fig.path=paste0(output_figprefix,
paste0(MANUSCRIPT_CONFIG$output_suffix, '-')))
```
```{r child='child/05-infected-vs-uninfected-setup.Rmd'}
```
```{r child='child/05-infected-vs-uninfected-main.Rmd'}
```
### Summary of enrichment results
```{r child='child/00-shared-summary-of-enrichment-results.Rmd'}
```
### Save Results
```{r child='child/00-shared-save-tables.Rmd'}
```
# System Information
```{r sysinfo}
sessionInfo()
```
```{r git_commit}
# manuscript-specific code (https://github.com/elsayed-lab/manuscript-coex-networks)
system('git rev-parse --short HEAD', intern = TRUE)
# shared code (https://github.com/elsayed-lab/manuscript-shared-rnaseq)
system('git --git-dir=$UMD/2015/00-shared/.git rev-parse --short HEAD', intern = TRUE)
```
```{r save_output, include=FALSE}
# Give rmarkdown some time to finish convern and then copy original rmarkdown
# along with output images and HTML to archive location
html_filepath <- file.path(output_prefix, paste0(MANUSCRIPT_CONFIG$output_prefix, '.html'))
pdf_filepath <- file.path(output_prefix, paste0(MANUSCRIPT_CONFIG$output_prefix, '.pdf'))
if (opts_knit$get("rmarkdown.pandoc.to") == 'latex') {
system(sprintf('(sleep 60 && mv 05-infected-vs-uninfected.pdf %s) &', pdf_filepath))
} else {
system(sprintf('(sleep 60 && mv 05-infected-vs-uninfected.html %s) &', html_filepath))
}
# free up memory for pandoc
rm(diff)
suppressMessages(gc())
```