-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBLUE_Hs_time.Rmd.bu
175 lines (147 loc) · 4.89 KB
/
BLUE_Hs_time.Rmd.bu
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
---
title: "BLUE Human 3-6hrs. VS 0hrs."
output:
flexdashboard::flex_dashboard:
navbar:
- { title: "Ca TR VS FP", href: "BLUE_ca_TRVFP.html" , align: "right"}
- { title: "Ca 6-24hr VS 3hr", href: "BLUE_ca_time.html" , align: "right"}
- { title: "Ca CEC3609 V CEC3672", href: "BLUE_ca_3609V3672.html" , align: "right"}
- { title: "Hs CEC3609 V CEC3672", href: "BLUE_Hs_3609V3672.html" , align: "right"}
- { title: "Main", href: "index.html" , align: "right"}
# self_contained: F
# vertical_layout: scroll
# source: embed
# widescreen: true
# fig_width: 7
# fig_height: 6
# fig_caption: true
df_print: kable
# css: https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
options(knitr.duplicate.label = "allow")
# Path and file names
# root folder
RootFolder=dirname(rstudioapi::getSourceEditorContext()$path)
setwd(RootFolder)
# Load home made function and variable and libraries
source(file.path("R", "RTools.R"))
source(file.path("R","20200610-DGE_library_functions.R"))
source(file.path("R","GO.R"))
library(data.table)
library(knitr)
library(kableExtra)
library(ggsignif)
library(ggpubr)
library(grid)
library(gridExtra)
library(RColorBrewer)
library(org.Hs.eg.db)
library(crosstalk)
# Check Ca GO db is install
Data_dir=file.path("Data")
if( ! require( "org.Calbicans.eg.db" , character.only = TRUE ) ){
BuildCaGOdb_CP(OuputDir = Data_dir)
install.packages(file.path(Data_dir,"org.Calbicans.eg.db"),repos = NULL)
}
```
Normalisation {.storyboard}
=====================================
```{r Var Hs BRAUN}
Pair="BLUE"
# Path and file names
# root folder
# RootFolder="/media/edurandau/DATA/Eric_Durandau/Sanglard/Labbook/Workbench/Bioinformatics/GREEN-BRAUN-data_exploration/Tests"
# Output subfolder name
# OutputFolder="Hs_3-6h_V_0h"
# Outputfolder path
# OutputFolderPath=file.path(RootFolder,OutputFolder)
# Raw data table
Path2Data=file.path(Data_dir,"20210611-Hs_BLUE_Raw_ReadCount.tsv")
# Table containing the list of sample ID and coresponding real names
Path2SubTbl=file.path(Data_dir,"BLUE_SampleInfos.tsv")
# Read count table with corrected sample names
RC_correctedSampleNames=paste0(Pair,"Hs_CountTable_SampleNames.tbl",collapse = "_")
LoadDataFn=LoadRawReadCountsHs
# Variable related to Normalisation, Differential expression analysis, clustering and the GO part
# NORMALISATION
# RegEx pattern enabling to extract the MetaData from samples real names
RegexPattern="(?<Isolate>\\w{3}\\d{4})_(?<replicate>\\d{1})_(?<condition>\\w{2})_(?<time>\\d{1,2y})"
# RegEx pattern enabling to remove some sample from the analysis
# ExcludeSampleRegex="(?<Isolate>\\w{3}(3621|3678))_(?<replicate>\\d+)"
ExcludeSampleRegex="(_NI)"
# Metadata column to conserve in the "Genes" table. Renames the column to make it compatible with HomeMade functions
GenesMetaData=c("Gene", "ORF19_ID","ASSEMBLY22_ID","Chr","Start", "End","Length","EntrezID","Note")
Colnames4Genes=GenesMetaData
# Additional factor for the normalisation and DE
AdditionalFact=c("time", "Isolate")
# pattern to extract chromosome name
Pattern_X="\\w+"
```
```{r BRAUN Hm normalisation, child="R/20210526-Normalisation.Rmd"}
```
Differential gene expression analysis {.storyboard}
=====================================
```{r setup DEG Hm Time}
# DEG
NameSharedData="Hm_time"
# Variable for the contrast map to define the comparaison to perform
DE_Contrast_Cond=AdditionalFact
Ref=c( 0,"CEC3605")
# Sample="Conditions"
# Select the main comparaison variable
MainComparaison="time"
SecondaryComparaison=AdditionalFact
# define the log2FC cutoff and the pvalue cutoff
LFC_Cutoff=0.5
pVal_Cutoff=0.05
# Clustering
# Number of cluster
ClustNumb=4
# distance method
DistMethod="manhattan"
# agglomeration method
AggloMethod="centroid"
# Decide Cutoff. for example if 3 , gene is selected if differentially expressed in 1/3 of comparisons
Factor_Numb_Conditions_gene_diff_expressed=3
```
```{r KnitDEG Hm Time, child="R/20210526-DEG.Rmd"}
```
GO
=====================================
```{r GO Hm TR-FP setup}
# GO enrichment
# library(org.Calbicans.eg.db)
# GO enrichment
library(org.Hs.eg.db)
OrgDb=org.Hs.eg.db
keytype="ENTREZID"
GO_pValue=0.1
GO_qValue=GO_pValue
MinGO=10
MaxGO=500
# STRING
STRING_DB=string_db_Hs
StringConnection=50
```
```{r prepare Go hs time, child="R/20210608-GO.Rmd"}
```
```{r Plot GO Hs time, child="R/20210608-GO_Plots_Interactive.Rmd"}
```
Gene Networks
=====================================
Column {.tabset}
-------------------------------------
```{r Plot GO hs time, comment='', echo=FALSE, message=FALSE, warning=FALSE, results="asis"}
out = NULL
for (i in ClustersID) {
C=i
if (length(PlotList[[as.character(C)]])<2){
print("No GO emerge from that list of gene")
}else{
out <- c(out, knit_child(file.path("R",'20210608-GO_Plots.Rmd'), quiet=TRUE))
}
}
cat(knit(text=unlist(paste(out, collapse = '\n')), quiet=TRUE))
```