-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlatformMerging.R
More file actions
executable file
·25 lines (22 loc) · 1.23 KB
/
Copy pathPlatformMerging.R
File metadata and controls
executable file
·25 lines (22 loc) · 1.23 KB
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
PlatformMerging <- function(gselist, GPL.length){
#Open every GSE, specify in the configuration CSV, from InsilicoDB and create a list of Eset
#structure call gselist
#
# Args:
# gselist: Containt the gselist with every GSE.
# GPL.length: Is the length of the GPL vector, it specify how many platform that need to be merge
#
# Returns:
# The GSE which each platform has been merge
index <- length(gselist)-GPL.length+1
for (i in 1:GPL.length-1){
missing.genes <- setdiff(rownames(exprs(gselist[[index+i]])),rownames(exprs(gselist[[index]])))
exprs(gselist[[index]]) <- rbind(exprs(gselist[[index]]), exprs(gselist[[index+i]])[match(missing.genes, rownames(exprs(gselist[[index+i]]))), ,drop=FALSE])
gene.id <- sapply(missing.genes, function(x){strsplit(x, "\\.")[[1]][2]})
index2 <- match(gene.id, Biobase::featureData(gselist[[index+i]])@data[ ,1])
gene.annotation.matrix <- Biobase::featureData(gselist[[index+i]])@data[index2, ]
colnames(gene.annotation.matrix) <- colnames(Biobase::featureData(gselist[[index]])@data)
Biobase::featureData(gselist[[index]])@data <- rbind(Biobase::featureData(gselist[[index]])@data, gene.annotation.matrix)
}
return(gselist[[index]])
}