forked from mohsinali1990/My_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TASSEL_GLM_MLM_2_Manhattan_QQ_plot_script.R
56 lines (45 loc) · 1.15 KB
/
TASSEL_GLM_MLM_2_Manhattan_QQ_plot_script.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
library(qqman)
library(dplyr)
# import TASSEL results
# note
TASSEL_MLM_Out <- read.table("TASSEL_MLM_out_mdp_genotype_+_mdp_traits_+_PC_mdp_genotype_stats.txt", header = T, sep = "\t")
# Number of traits
head(unique(TASSEL_MLM_Out$Trait))
# note: for each plot trait name must be specificed
# first trait as example (i.e., EarHT)
Trait1 <- TASSEL_MLM_Out %>% filter(.$Trait == "EarHT")
# Bonferroni correction threshold
nmrk <- nrow(Trait1)
(GWAS_Bonn_corr_threshold <- -log10(0.05 / nmrk))
# Manhattan plot
(Mann_plot <- manhattan(
TASSEL_MLM_Out,
chr = "Chr",
bp = "Pos",
snp = "Marker",
p = "p",
col = c("red", "blue"),
annotateTop = T,
genomewideline = GWAS_Bonn_corr_threshold,
suggestiveline = F
)
)
# QQ plot
QQ_plot <- qq(TASSEL_MLM_Out$p)
# Manhattan and Q-Q plot arranged in 1 rows and 2 columns
old_par <- par()
par(mfrow=c(1,2))
(Mann_plot <- manhattan(
TASSEL_MLM_Out,
chr = "Chr",
bp = "Pos",
snp = "Marker",
p = "p",
col = c("red", "blue"),
annotateTop = T,
genomewideline = GWAS_Bonn_corr_threshold,
suggestiveline = F,
main = "EarHT" # trait name
)
)
(QQ_plot <- qq(TASSEL_MLM_Out$p, main = "EarHT" ))