-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
512 lines (512 loc) · 14.4 KB
/
.Rhistory
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
Entrez_gene_ids_sign <- res$ENTREZID[(res$FDR < 0.01) & (res$logFC > 4)]
# Downregulated:
#Entrez_gene_ids_sign <- res$ENTREZID[(res$FDR < 0.01) & (res$logFC < -4)]
# General disruption:
#Entrez_gene_ids_sign <- res$ENTREZID[(res$FDR < 0.01) & (abs(res$logFC) > 4)]
Entrez_gene_ids_sign <- Entrez_gene_ids_sign[!is.na(Entrez_gene_ids_sign)]
Entrez_gene_ids_sign <- sort(as.character(Entrez_gene_ids_sign))
length(Entrez_gene_ids_sign)
# Write IDs to file
write.table(Entrez_gene_ids_background, file="Entrez_gene_ids_background.txt",
col.names=F, quote=F, row.names=F)
write.table(Entrez_gene_ids_sign, file="Entrez_gene_ids_sign.txt",
col.names=F, quote=F, row.names=F)
# Load data for one individual sample
dat_lengths <- read.table("GSM1545545_JMS9-P8c.txt", header=T, sep="\t")
head(dat_lengths)
# Sort based on Entrez IDs
dat_lengths_sorted <- dat_lengths[sort(as.character(dat_lengths$EntrezID),index.return=T)$ix, ]
# Sort the results based on Entrez IDs
res_sorted <- res[sort(as.character(res$ENTREZID),index.return=T)$ix, ]
# Select the ones that are in the results table
dat_lengths_sorted <- dat_lengths_sorted[dat_lengths_sorted$EntrezID %in% res$ENTREZID, ]
# Check if order and amount of Entrez IDs is correct
all(dat_lengths_sorted$EntrezID == res_sorted$ENTREZID)
# Add gene lengths to results
res_sorted$Lengths <- dat_lengths_sorted$GeneLength
head(res_sorted)
# GO analysis
gsa <- goana(sort(Entrez_gene_ids_sign),
species = "Mm",
universe = sort(Entrez_gene_ids_background),
trend = res_sorted$Lengths)
head(gsa)
# Sort results and calculate FDR
gsa <- gsa[sort(gsa$P.DE,index.return=T)$ix,]
gsa$P.DE.adj <- p.adjust(gsa$P.DE, n=nrow(gsa), method="BH")
head(gsa)
# Write results
write.table(gsa, file="GSA_analysis_all.txt", col.names = T,
row.names = F, quote = F, sep="\t")
View(gsa)
?parlapply
??parlapply
?mblogit
??mblogit
library(mclogit)
install.packages("mclogit")
library(mclogit)
?mblogit
load("~/MultiData.RData")
# Fit the model:
MultiData.mblogit <- mblogit(formula = Bin ~ Genotype,
random = ~1|BC,
weights = count,
data = MultiData)
?mclogit
?VGAM::zibinomial
install.packages(VGAM)
install.packages("VGAM")
?VGAM::zibinomial
?VGAM::zimultinomial
??zimultinomial
MAGE::LOItest_logreg(c(5, 8, 10, 3, 5, 6, 23), c(8, 8, 6, 4, 4, 10, 0),
c(5, 0, 0, 3, 5, 1, 23), c(1, 8, 6, 2, 0, 10, 0))
?mclogit
?mblogit
load("~/SCRIPT7_DI_results_genes.RData")
View(DI_results_genes)
load("~/SCRIPT7_DI_results_SNP.RData")
View(DI_results_SNP)
load("~/SCRIPT7_DI_results_genes.RData")
View(DI_results_genes)
load("~/SCRIPT7_DI_results_genes.RData")
View(DI_results_genes)
load("~/SCRIPT7_DI_results_SNP.RData")
View(DI_results_SNP)
View(DI_results_SNP)
load("~/SignTab2.RData")
View(SignTab)
SignTabClone <- SignTab
load("~/SignTab2_New.RData")
View(SignTabClone)
View(SignTab)
sum(SignTab$p_DI_FDR < 0.05)
sum(SignTabClone$p_DI_FDR < 0.05)
SignTab$Gene[SignTab$p_DI_FDR < 0.05]
SignTabClone$Gene[SignTabClone$p_DI_FDR < 0.05]
View(SignTab)
View(SignTabClone)
load("~/SignSNP2.RData")
View(SignSNP)
View(SignTab)
View(SignTab)
View(SignTabClone)
View(SignTab)
load("~/ResTAB_Genes_X.RData")
View(ResTAB_Genes)
sum(ResTAB_Genes$p_DI_FDR < 0.05)
sum(ResTAB_Genes$p_DI_FDR < 0.05 & ResTAB_Genes$nSNP > 1)
View(SignTab)
View(ResTAB_Genes)
sum(ResTAB_Genes$nSNP)
View(ResTAB_Genes)
load("~/ResTAB_Genes_X.RData")
View(ResTAB_Genes)
ResTAB_Genes$Gene[ResTAB_Genes$p_DI_FDR < 0.05 & ResTAB_Genes$nSNP > 1]
load("~/SignTab2.RData")
SignTab2$Gene[SignTab2$p_DI_FDR < 0.05 & SignTab2$nSNP > 1]
SignTab$Gene[SignTab$p_DI_FDR < 0.05 & SignTab$nSNP > 1]
View(SignTab)
View(ResTAB_Genes)
??write_xlsx
?dummy.coef
-log(0.05)
?zoo::rollmedian
substr("zalkrjkjkl", 1, 12)
substr("zalkrjkezfezfezjkl", 1, 12)
load("~/MAGEgenotyper/DE_Meth_CNV_Kidney.RData")
View(results_meth450)
View(results_meth450)
?patchwork::plot_layout
AD_Data <- unique(AD_Data_X[,c("gene", "rho_control", "rho_case", "pval")])
?read.rable
?read.table
?ggplot2::theme
?ggplot2::element_rect
??enrichGO
library(clusterProfiler)
BiocManager::install("clusterProfiler")
library(clusterProfiler)
BiocManager::install("clusterProfiler")
BiocManager::install("clusterProfiler", force = TRUE)
library(clusterProfiler)
library(readxl)
?read_excel
?wilcox.test
install.packages("ggplot2")
install.packages("ggplot2")
install.packages("ggplot2")
install.packages("ggplot2")
?ggsave
1/((1/0.1)+1)
1/((1/10)+1)
0.9090909/(1-0.9090909)
?t.test
sign.test
library(rstatix)
install.packages("rstatix")
library(rstatix)
sign_test()
?sign_test
?wilcox.test
?rbinom
?wilcox.test
?wilcox.test
?ggplot2::geom_boxplot
?quantiles
?quantile
?lm
?rlm
library(MASS)
rlm()
logit(200)
??logit
library(robustbase)
install.packages("robustbase")
library(robustbase)
?weights.lmrob
load("~/MMXres.RData")
op <- par(mfrow = c(2,2), mgp = c(1.5, 0.6, 0), mar= .1+c(3,3,3,1))
plot(MMX, which = c(1:2, 4:5))
par(op)
library(performance)
install.packages("performance")
library(performance)
load("~/MMXres.RData")
load("~/MMX_R.RData")
check_model(MMX_R)
diagnostic_plots <- plot(check_model(MMX_R, panel = FALSE))
diagnostic_plots[[1]]
diagnostic_plots[[1]]
diagnostic_plots[[2]]
diagnostic_plots[[3]]
diagnostic_plots[[4]]
diagnostic_plots[[5]]
diagnostic_plots[[6]]
check_model(MMX_R)
png(file="AA_RR2.png")
check_model(MMX_R)
dev.off()
setwd("~/")
png(file="AA_RR2.png")
op <- par(mfrow = c(2,2), mgp = c(1.5, 0.6, 0), mar= .1+c(3,3,3,1))
plot(MMX_R, which = c(1:2, 4:5))
par(op)
dev.off()
png(file="AA_RR2.png")
op <- par(mfrow = c(2,2), mgp = c(1.5, 0.6, 0), mar= .1+c(3,3,3,1))
plot(MMX_R, which = c(1:2, 3:4))
par(op)
dev.off()
png(file="AA_RR2.png")
op <- par(mfrow = c(2,2), mgp = c(1.5, 0.6, 0), mar= .1+c(3,3,3,1))
plot(MMX_R, which = c(1:2, c(3,5)))
par(op)
dev.off()
load("~/MMX_M.RData")
load("~/MMX_M.RData")
png(file="AA_MM2.png")
op <- par(mfrow = c(2,2), mgp = c(1.5, 0.6, 0), mar= .1+c(3,3,3,1))
plot(MMX_M, which = c(1:2, c(3,5)))
par(op)
dev.off()
MMX_T <- lm(LogThetas ~ Type*SubSet, BoxesX[MMX$rweights > 0.01,])
load("~/MMX_T.RData")
png(file="AA_TT2.png")
op <- par(mfrow = c(2,2), mgp = c(1.5, 0.6, 0), mar= .1+c(3,3,3,1))
plot(MMX_T, which = c(1:2, c(3,5)))
par(op)
dev.off()
library(ggplot2)
set.seed(123)
dat <- data.frame(
x=rep( c(1, 2, 3, 4), times=25 ),
y=rnorm(100),
gp=rep(1:2, each=50)
)
p <- ggplot(dat, aes(x=factor(x), y=y))
p + geom_boxplot(aes(fill = factor(gp))) #example 1
p <- ggplot(dat, aes(x=factor(x), y=y))
p + geom_boxplot(aes(fill = factor(gp))) +
scale_x_discrete(limits=1:7)
?aes
?ggsave
?expression
?guide_legend
?scale_color_manual
?scale_fill_discrete
?element_text
?glht
??glht
library(multcomp)
PValv <- c(1.026082e-11, 7.881533e-116, 4.572330e-72, 4.743876e-01, 1.542418e-03, 5.253850e-03)
?p.adjust
?legend.box
??legend.box
load("~/bp2.RData")
load("~/bp2.RData")
install.packages("DOSE")
BiocManager::install("DOSE")
BiocManager::install("DOSE", force = TRUE)
load("~/bp2.RData")
library(DOSE)
BiocManager::install("GOSemSim", force = TRUE)
load("~/bp2.RData")
clusterProfiler::simlify
clusterProfiler::simlify()
?clusterProfiler::simlify
?clusterProfiler::simplify
load("~/EnrTabs.RData")
View(EnrJustdAD)
View(EnrBoth)
load("~/EnrTabs.RData")
View(EnrJustdAD)
View(EnrBoth)
?simplify
View(EnrJustdAD)
View(EnrBoth)
max(4,7)
load("~/EnrTabs.RData")
View(EnrJustdAD)
View(EnrBoth)
log(1.5)
log2(1.5)
load("~/EnrJustDE.RData")
View(EnrJustDE)
?ggplot2::geom_histogram
??plot_annotation
?seq
0:1:0.1
0:0.1:1
seq(0.5,1,0.06)
nbins = 5
seq((1/nbins)/2,1,(1/nbins))
HV <- seq((1/nbins)/2,1,(1/nbins))
HV2 <- seq((1/nbins),1,(1/nbins))
HV
HV2
HV <- seq((1/nbins)/2,1,(1/nbins))
HV2 <- seq((1/nbins),1,(1/nbins))
HV2 <- HV2[HV2 != 1]
HV2
HV
ScaleCountV <- (0:ScaleCount)/ScaleCount
nbins
HV
HV2
HV2 <- seq((1/nbins),1,(1/nbins))
HV2
HV2 <- seq(0,1,(1/nbins))
HV2
seq(0,1,(1/nbins))
seq(0,1,(1/100))
seq(0,1,(1/100))
seq((1/100)/2,1,(1/100))
HV <- seq((1/nbins)/2,1,(1/nbins))
HV2 <- seq(0,1,(1/nbins))
HV2X <- HV2[HV2 != 1]
HV2Y <- HV2[HV2 != 0]
MD <- data.frame("Binstart" = HV2X, "Binend" = HV2Y)
MD
MD <- data.frame("Binstart" = HV2X, "Binend" = HV2Y, "Data" = 0, "Pos" = HV, "DataRR" = 0, "DataVV" = 0, "DataRV" = 0)
MD
length(Dat_RRData)
load("~/MAGEgenotyper/UpdatedImpr.RData")
View(ResTAB_Genes)
?intersect
setwd("~/MAGEgenotyper")
SNP_DAT <- read.table("SNPdata.txt", header = TRUE, sep = "\t")
?cor
?qbinon
?qbinom
qbinom(5,10,0.4)
pbinom(5,10,0.4)
pbinom(5,10,0.6)
pbinom(5,10,0.5)
pbinom(4,10,0.5)
dbinom(5,10,0.5)
pbinom(5,10,0.5)
(1-pbinom(5,10,0.5))+dbinom(5,10,0.5)
min(4, 9)
load("~/MAGEgenotyper/TopHits.RData")
View(TopHits)
View(TopHits)
?hist
load("~/MAGEgenotyper/TopHits.RData")
View(TopHits)
?dbinom
dbinom(0,10,0.1)
dbinom(1,10,0.1)
dbinom(0,10,0.1) + 0.5*dbinom(1,10,0.1)
load("~/MAGEgenotyper/TopHits.RData")
View(TopHits)
View(TopHits)
2*((100/(100))-0.5)
2*((50/(100))-0.5)
load("~/MAGEgenotyper/TopHits.RData")
View(TopHits)
load("~/MAGEgenotyper/TopHits.RData")
load("~/MAGEgenotyper/GENEdata_Complete_Tops.RData")
View(GENEdata_Complete_Tops)
load("~/MAGEgenotyper/TopHits.RData")
View(TopHits)
load("~/MAGEgenotyper/GENEdata_Complete_Tops.RData")
load("~/MAGEgenotyper/GENEdata_Complete_AUTO.RData")
View(GENEdata_Complete)
load("~/MAGEgenotyper/GENEdata_Complete_Tops.RData")
View(GENEdata_Complete_Tops)
View(GENEdata_Complete)
9.780229e-02 / 8.319328e-03
1.269272e-01/ 2.892441e-02
?cor.test
load("~/MAGEgenotyper/AR.RData")
View(AR)
paste0("sklzmjfkl", "fklzjfkoejzkfjklzjkljr", "4")
?cor.test
?dbinom
sum(GENEdata_Complete$ &
load("~/MAGEgenotyper/GENEdata_Complete_Tops.RData")
View(GENEdata_Complete_Tops)
load("~/MAGEgenotyper/GENEdata_Complete_Tops.RData")
load("~/MAGEgenotyper/GENEdata_Complete_Tops.RData")
View(GENEdata_Complete_Tops)
View(GENEdata_Complete_Tops)
View(GENEdata_Complete_Tops)
?order
load("~/MAGEgenotyper/AR.RData")
View(AR)
load("~/MAGEgenotyper/GENEdata_Complete_Tops_TRUERESULT.RData")
load("~/MAGEgenotyper/GENEdata_Complete_Tops_TRUERESULT.RData")
View(GENEdata_Complete_Tops)
View(GENEdata_Complete_Tops)
GENEdata_Complete_Tops$MethProbe
GENEdata_Complete_Tops$MethProbe <- "None"
GENEdata_Complete_Tops$CNA_AD_Corr <- NA
GENEdata_Complete_Tops$Meth_AD_Corr <- NA
View(GENEdata_Complete_Tops)
View(GENEdata_Complete_Tops)
GENEdata_Complete_Tops$MedianCovList
GENEdata_Complete_Tops$MedianCovList[[1]]
GENEdata_Complete_Tops$SNPoi <- "None"
View(GENEdata_Complete_Tops)
GENEdata_Complete_Tops$SNPoi
View(GENEdata_Complete_Tops)
GENEdata_Complete_Tops$SNPsoi
GENEdata_Complete_Tops$SNPsoi <- "None"
GENEdata_Complete_Tops$CNA_Meth_Corr <- NA
library(GO.db)
View(GENEdata_Complete_Tops)
GENEdata_Complete_Tops <- GENEdata_Complete_Tops[GENEdata_Complete_Tops$gene != "MRAS",]
load("~/MAGEgenotyper/GT2s.RData")
View(GENEdata_Complete_Tops)
View(GT_Sub)
View(GT_Sub)
sum(GT_Sub$CNA_Meth_Corr>0)
sum(GT_Sub$CNA_Meth_Corr[!is.na(GT_Sub$CNA_Meth_Corr)]>0)
sum(GT_Sub$CNA_Meth_Corr[!is.na(GT_Sub$CNA_Meth_Corr)]<0)
sum(GT_Sub$Meth_AD_Corr[!is.na(GT_Sub$Meth_AD_Corr)]>0)
sum(GT_Sub$Meth_AD_Corr[!is.na(GT_Sub$Meth_AD_Corr)]<0)
sum(GT_Sub$CNA_AD_Corr[!is.na(GT_Sub$CNA_AD_Corr)]>0)
sum(GT_Sub$CNA_AD_Corr[!is.na(GT_Sub$CNA_AD_Corr)]<0)
sum(GT_Sub$SpearmanMaxV[!is.na(GT_Sub$SpearmanMaxV)]<0)
sum(GT_Sub$SpearmanMaxV[!is.na(GT_Sub$SpearmanMaxV)]>0)
load("~/MAGEgenotyper/EnrTabs_TRUE.RData")
View(EnrJustdAD)
View(EnrBoth)
load("~/MAGEgenotyper/EnrJustDE_TRUE.RData")
View(EnrJustDE)
130000000
1.3*1000000
1.3*10000000
130*1000000
100000000
?pbinom
-log(0.03)
-log(0.45)
View(GT_Sub)
View(GT_Sub)
View(GT_Sub)
View(GENEdata_Complete_Tops)
GENEdata_Complete_Tops$SpearmanListV[[3]]
GENEdata_Complete_Tops$SpearmanListT[[3]]
GENEdata_Complete_Tops$SpearmanListT[[which(GENEdata_Complete_Tops$gene == "ALPK3")]]
GENEdata_Complete_Tops$SpearmanListV[[which(GENEdata_Complete_Tops$gene == "ALPK3")]]
GENEdata_Complete_Tops$MedianCovList[[which(GENEdata_Complete_Tops$gene == "ALPK3")]]
load("~/MAGEgenotyper/GENEdata_Complete_AUTO.RData")
View(GENEdata_Complete)
View(GT_Sub)
r"zklamjd"
r"test"
dir <- r"(c:\Program files\R)"
dir
r"(c:\Program files\R)"
install.packages("gmp")
install.packages("RcppGSL")
install.packages("alabama")
install.packages("Rdpack")
install.packages("maelstRom_1.1.8.tar.gz", repos = NULL, type="source")
library(devtools)
load("~/MAGEgenotyper/maelstRom/data/maelstRom.RData")
install.packages("maelstRom_1.1.8.tar.gz", repos = NULL, type="source")
library(devtools)
install.packages("maelstRom_1.1.8.tar.gz", repos = NULL, type="source")
install.packages("maelstRom_1.1.8.tar.gz", repos = NULL, type="source")
setwd("~/MAGEgenotyper")
install.packages("maelstRom_1.1.8.tar.gz", repos = NULL, type="source")
?install.packages
install.packages("maelstRom_1.1.9.tar.gz", repos = NULL, type="source")
install.packages("maelstRom_1.1.9.tar.gz", repos = NULL, type="source")
install.packages("maelstRom_1.1.9.tar.gz", repos = NULL, type="source", INSTALL_opts=c("--no-multiarch"))
install.packages("devtools")
library(devtools)
library(devtools)
install.packages("fastmap")
library(devtools)
devtools::install("maelstRom_1.1.9.tar.gz", repos = NULL, type="source", INSTALL_opts=c("--no-multiarch"))
?devtools::install
devtools::install_local("maelstRom_1.1.9.tar.gz", repos = NULL, type="source", INSTALL_opts=c("--no-multiarch"))
install.packages("Rcppgsl")
install.packages("RcppGSL")
install.packages("BH")
install.packages("Rcpp")
install.packages("Rcpp")
install.packages("zoo")
install.packages("scales")
install.packages("patchwork")
install.packages("ggnewscale")
install.packages("jsonlite")
install.packages("Rdpack")
install.packages("alabama")
install.packages("gtools")
install.packages("data.table")
install.packages("ggplot2")
install.packages("stringr")
install.packages("hash")
install.packages("gmp")
devtools::install_local("maelstRom_1.1.9.tar.gz", repos = NULL, type="source", INSTALL_opts=c("--no-multiarch"))
devtools::install_local("maelstRom_1.1.9.tar.gz", repos = NULL, type="source", INSTALL_opts=c("--no-multiarch"))
package_version("Rcpp")
packageVersion("Rcpp")
Rcpp::compileAttributes()
setwd("~/MAGEgenotyper/maelstRom")
Rcpp::compileAttributes()
Sys.setenv("PKG_LIBS" = "-lmpfr -lgmp")
setwd("~/MAGEgenotyper")
devtools::install_local("maelstRom_1.1.9.tar.gz", repos = NULL, type="source", INSTALL_opts=c("--no-multiarch"))
Sys.setenv("PKG_LIBS" = "-lmpfr -lgmp -lgsl")
setwd("~/MAGEgenotyper/maelstRom")
Sys.setenv("PKG_LIBS" = "-lmpfr -lgmp -lgsl")
Rcpp::compileAttributes()
?pkgdown::build_site
pkgdown::build_site()
usethis::use_github(private = FALSE)
source("~/.active-rstudio-document", echo=TRUE)
t(c(1,2,3,4,5,6,7))
load("~/MAGEgenotyper/GENEdata_Table3.RData")
View(GENEdata_Table3)
GENEdata_Table3SS <- GENEdata_Table3[, c(-40:-30) ]
View(GENEdata_Table3SS)
GENEdata_Table3SS <- GENEdata_Table3[, c(-30:-20) ]
?glm
?lm