-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpl_gen_Illumina.R
57 lines (47 loc) · 1.78 KB
/
gpl_gen_Illumina.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
library(hash)
library(readxl)
options("max.print"=1E9)
options(digits=4)
gpl <- read_excel("C:/Users/nacho/Desktop/GPL_illumina/GPL6104-11576.xlsx")
gpl <- read_excel("C:/Users/nacho/Desktop/GPL_illumina/GPL6883-11606.xlsx")
gpl <- read_excel("C:/Users/nacho/Desktop/GPL_illumina/GPL6947-13512.xlsx")
gpl <- read_excel("C:/Users/nacho/Desktop/GPL_illumina/GPL10558-50081.xlsx")
datos <- read.table("c.txt", quote="\"", comment.char="")
gpl$`Gene stable ID`[is.na(gpl$`Gene stable ID`)] <- 0
hm <- hash(keys=gpl$ID, values=gpl$`Gene stable ID`)
rnames <- rownames(datos)
for(i in 1:nrow(datos)){
rnames[i] <- if(is.null(hm[[rnames[i]]])){0}else{hm[[rnames[i]]]}
}
datos$gen <- rnames
datos <- datos[datos$gen!="0",]
sink("c2.txt")
print(datos)
sink()
# Por si hay sondas repetidas
c <- read.table("C:/Users/nacho/Desktop/Illumina/GSE46448_/c.txt", row.names=NULL, quote="\"", comment.char="")
n_occur <- data.frame(table(datos$row.names))
datos <- datos[!(n_occur$Freq > 1),]
rownames(datos) <- datos$row.names
datos[,-1]
genes <- datos0$gen
nombs <- data.frame(sonda = rownames(datos), gen = genes)
genes <- c()
for (sonda in rownames(PacientevsControl)) {
genes <- c(genes, nombs$gen[nombs$sonda==sonda])
}
PacientevsControl$gen <- genes
tabla <- c()
for (nombre in base::unique(PacientevsControl$gen)){
g <- PacientevsControl[PacientevsControl$gen==nombre,]
PacientevsControl <- PacientevsControl[!PacientevsControl$gen==nombre,]
g <- g[which.max(g$adj.P.Val),]
tabla <- rbind(tabla,g)
}
PacientevsControl <- tabla
datos <- datos[rownames(PacientevsControl),]
rownames(PacientevsControl) <- PacientevsControl$gen
rownames(datos) <- PacientevsControl$gen
PacientevsControl <- subset(PacientevsControl,select = -gen)
PacientevsControl <- PacientevsControl[order(tabla$adj.P.Val),]
head(PacientevsControl)