-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCorrespondence.R
executable file
·159 lines (101 loc) · 3.61 KB
/
Correspondence.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
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
#### Comparing WGS with GBS markers ###
############################################################################################################
######### Compare 5 cassavas WITH FILTERED AR DATA ############
############################################################################################################
setwd("/home/DB2/Imputation/BEAGLE_imputation/correspondence/Imputation_v2/validation_filter/")
GBS3 <- read.delim("f03.DS.FORMAT")
GBS5 <- read.delim("f05.DS.FORMAT")
WGS <- read.delim("reference.DS.FORMAT")
WGS[,1] <- paste("S",WGS[,1],"_", WGS[,2], sep="")
rownames(WGS) <- WGS[,1]
WGS <- WGS[,-1]
WGS <- WGS[,-1]
WGS <- t(WGS)
############# Working with filter 0.3
GBS3[,1] <- paste("S",GBS3[,1],"_", GBS3[,2], sep="")
rownames(GBS3) <- GBS3[,1]
GBS3 <- GBS3[,-1]
GBS3 <- GBS3[,-1]
GBS3 <- t(GBS3)
markers3 <- which(colnames(WGS) %in% colnames(GBS3))
WGS3 <- WGS[,markers3]
matriz3 <- rbind(WGS3, GBS3)
matriz3 <- matriz3 -1
library(rrBLUP)
K <- A.mat(matriz3)
library(RColorBrewer)
library(rrBLUP)
library(gplots)
y <- K
a <- heatmap.2(y, col=bluered, tracecol="#303030",
margins = c(9, 12))
#Getting some numbers:
matrix_round <- round(matriz3)
mini <- matrix_round[sort(rownames(matrix_round)[6:23]),]
a <- as.numeric(matrix_round[5,])
tmp <- vector()
for (f in 1:18) {
b <- as.numeric(mini[f,])
counter <- 1
for (i in 1:length(a)){
if (a[i]==b[i]){counter = counter + 1}
}
tmp <- c(tmp, counter/length(a))
}
Percentage[,5] <- tmp
write.table(Percentage, file='/home/roberto/Desktop/table',sep = "\t", quote = F, col.names = F, row.names = F)
############################################################################################################
######### Compare 5 cassavas that were WGS with the same cassavas that were projected from GBS ############
############################################################################################################
setwd("/home/DB2/Imputation/BEAGLE_imputation/correspondence/Imputation_v2/validation/")
#Loading the files and formatting
GBS <- read.delim("imputed.DS.FORMAT")
WGS <- read.delim("reference.DS.FORMAT")
GBS[,1] <- paste("S",GBS[,1],"_", GBS[,2], sep="")
rownames(GBS) <- GBS[,1]
GBS <- GBS[,-1]
GBS <- GBS[,-1]
GBS <- t(GBS)
WGS[,1] <- paste("S",WGS[,1],"_", WGS[,2], sep="")
rownames(WGS) <- WGS[,1]
WGS <- WGS[,-1]
WGS <- WGS[,-1]
WGS <- t(WGS)
matriz <- rbind(WGS, GBS)
matriz <- matriz -1
library(rrBLUP)
K <- A.mat(matriz)
library(RColorBrewer)
library(rrBLUP)
library(gplots)
y <- K
a <- heatmap.2(y, col=bluered, tracecol="#303030",
margins = c(9, 12))
############################################################################################################
############# FIRST ATTEMPT WHEN THE VALIDATION WERE ALSO IN THE REFERENCE PANEL #########################
############################################################################################################
#### Loading the dosage files ----
setwd("/home/DB2/Imputation/BEAGLE_imputation/correspondence/")
#Loading the files and formatting
GBS <- read.delim("gbs_ds.FORMAT")
WGS <- read.delim("WGS.DS.FORMAT")
GBS[,1] <- paste("S",GBS[,1],"_", GBS[,2], sep="")
rownames(GBS) <- GBS[,1]
GBS <- GBS[,-1]
GBS <- GBS[,-1]
GBS <- t(GBS)
WGS[,1] <- paste("S",WGS[,1],"_", WGS[,2], sep="")
rownames(WGS) <- WGS[,1]
WGS <- WGS[,-1]
WGS <- WGS[,-1]
WGS <- t(WGS)
matriz <- rbind(WGS, GBS)
matriz <- matriz -1
library(rrBLUP)
K <- A.mat(matriz)
library(RColorBrewer)
library(rrBLUP)
library(gplots)
y <- K
a <- heatmap.2(y, col=bluered, tracecol="#303030",
margins = c(9, 12))