-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_analysis.R
109 lines (92 loc) · 7.45 KB
/
run_analysis.R
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
setwd("C:/Users/andre/Documents/WEHI/mgater")
source("mgate.R")
# Prepare data
# vector experiment names, must match the experiment names in Enrich2. you can check by
# looking at the name of the folder generated by Enrich2
exp_names <- c("RPMI", "IL3", "Tpo95", "Elt95", "Elt33", "S505N_RPMI", "S505N_IL3", "S505N_Tpo")
# vector of absolute paths to the combined score files for each experiment, in the order of
# experiments in exp_names
combined_score_files <- c("C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/RPMI/tsv/RPMI_exp/main_synonymous_scores.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/IL3/tsv/IL3_exp/main_synonymous_scores.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/Tpo95/tsv/Tpo95_exp/main_synonymous_scores.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/Elt95/tsv/Elt95_exp/main_synonymous_scores.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/Elt33/tsv/Elt33_exp/main_synonymous_scores.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/S505N_RPMI/tsv/S505N_RPMI_exp/main_synonymous_scores.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/S505N_IL3/tsv/S505N_IL3_exp/main_synonymous_scores.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/S505N_Tpo/tsv/S505N_Tpo_exp/main_synonymous_scores.tsv")
replicate_count_files <- c("C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/RPMI/tsv/RPMI_exp/main_synonymous_counts.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/IL3/tsv/IL3_exp/main_synonymous_counts.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/Tpo95/tsv/Tpo95_exp/main_synonymous_counts.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/Elt95/tsv/Elt95_exp/main_synonymous_counts.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/Elt33/tsv/Elt33_exp/main_synonymous_counts.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/S505N_RPMI/tsv/S505N_RPMI_exp/main_synonymous_counts.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/S505N_IL3/tsv/S505N_IL3_exp/main_synonymous_counts.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/S505N_Tpo/tsv/S505N_Tpo_exp/main_synonymous_counts.tsv")
replicate_score_files <- c("C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/RPMI/tsv/RPMI_exp/main_synonymous_scores_shared.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/IL3/tsv/IL3_exp/main_synonymous_scores_shared.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/Tpo95/tsv/Tpo95_exp/main_synonymous_scores_shared.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/Elt95/tsv/Elt95_exp/main_synonymous_scores_shared.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/Elt33/tsv/Elt33_exp/main_synonymous_scores_shared.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/S505N_RPMI/tsv/S505N_RPMI_exp/main_synonymous_scores_shared.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/S505N_IL3/tsv/S505N_IL3_exp/main_synonymous_scores_shared.tsv",
"C:/Users/andre/Documents/WEHI/TpoR_DMS_Data/Renormalised/S505N_Tpo/tsv/S505N_Tpo_exp/main_synonymous_scores_shared.tsv")
# selecting a subset of experiments to analyse
# here: RPMI, Tpo95, Elt95 and Elt33 are selected
selection <- c(T,F,T,T,T,F,F,F)
exp_names <- exp_names[selection]
combined_score_files <- combined_score_files[selection]
replicate_count_files <- replicate_count_files[selection]
replicate_score_files <- replicate_score_files[selection]
# Load data
md <- mdata_struct(exp_names, 486)
load_mfiles(md, combined_score_files, type="combined scores")
# always load counts after the scores
load_mfiles(md, replicate_count_files, type="replicate counts")
load_mfiles(md, replicate_score_files, type="replicate scores")
md$pos$`487` <- NULL
md$pos$`517` <- NULL
# Filter
filter_inactive(md, quant=1)
filter_functional(md, range=6)
set_mfilter(md, "filter_functional",
list("RPMI"=c(-Inf, md$mfilter$filter_functional$RPMI[[2]])))
filter_mutation_activated(md)
# Filter mutations over activated by Eltrombopag only
limits <- md$mfilter$filter_functional
limits[["Elt95"]][[1]] <- limits[["Elt95"]][[2]]
limits[["Elt95"]][[2]] <- Inf
limits[["Elt33"]][[2]] <- Inf
set_mfilter(md, "filter_elt_active", limits)
# Visualise data
# Filter inactive
mplot(md, type="termination", mfilter="filter_inactive")
mplot(md, type="filter", mfilter="filter_inactive")
mplot(md, type="near misses", mfilter="filter_inactive")
mplot(md, type="replicate violation", mfilter="filter_inactive")
mplot(md, type="filter heatmap", mfilter="filter_inactive")
mplot(md, type="filtered", mfilter="filter_inactive")
mplot(md, type="unfiltered", mfilter="filter_inactive")
# Filter functional
mplot(md, type="violin", mfilter="filter_functional", ignore="filter_inactive")
mplot(md, type="replicate violin", mfilter="filter_functional", ignore="filter_inactive")
mplot(md, type="filter by experiment", mfilter="filter_functional", ignore="filter_inactive")
mplot(md, type="filter", mfilter="filter_functional", ignore="filter_inactive")
mplot(md, type="filtered", mfilter="filter_functional", ignore="filter_inactive")
mplot(md, type="unfiltered", mfilter="filter_functional", ignore="filter_inactive")
mplot(md, type="filter heatmap", mfilter="filter_functional", ignore="filter_inactive")
mplot(md, type="replicate violation", mfilter="filter_functional", ignore="filter_inactive")
# Filter mutation activated
mplot(md, type="filter by experiment", mfilter="filter_mutation_activated", ignore=c("filter_inactive", "filter_functional"))
mplot(md, type="filter", mfilter="filter_mutation_activated", ignore=c("filter_inactive", "filter_functional"))
mplot(md, type="filtered", mfilter="filter_mutation_activated", ignore=c("filter_inactive", "filter_functional"))
mplot(md, type="unfiltered", mfilter="filter_mutation_activated", ignore=c("filter_inactive", "filter_functional"))
mplot(md, type="filter heatmap", mfilter="filter_mutation_activated", ignore=c("filter_inactive", "filter_functional"))
# Filter elt active
mplot(md, type="filter", mfilter="filter_elt_active", ignore=c("filter_inactive", "filter_functional", "filter_mutation_activated"))
mplot(md, type="filter line", mfilter="filter_elt_active", ignore=c("filter_mutation_activated", "filter_inactive", "filter_functional"))
mplot(md, type="filter heatmap", mfilter="filter_elt_active", ignore=c("filter_inactive", "filter_functional", "filter_mutation_activated"))
# Unfiltered
mplot(md, type="filter heatmap", mfilter="filter_elt_active", ignore=c("filter_inactive", "filter_functional", "filter_mutation_activated"))
#mplot(md, type="bar", args=1, mfilter="filter_functional" , ignore=c("filter_mutation_activated", "filter_inactive", "filter_functional", "filter_elt_active"))
c(p, df) %<-% mplot(md, type="bar all", mfilter="filter_functional", ignore=c("filter_mutation_activated", "filter_inactive", "filter_functional", "filter_elt_active"))
ggsave("unfiltered mutations, all bar plots.pdf", p)