-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProbeGeneMapping.R
More file actions
executable file
·29 lines (26 loc) · 1009 Bytes
/
Copy pathProbeGeneMapping.R
File metadata and controls
executable file
·29 lines (26 loc) · 1009 Bytes
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
ProbeGeneMapping2 <- function(gse_input){
#Open every GSE, specify in the configuration CSV, from InsilicoDB and create a list of Eset
#structure call gselist
#
# Args:
# gse_input: the GSE eset that need to be map.
#
# Returns:
# The GSE with the best probe gene mapping
gse <- gse_input
gid <- as.character(Biobase::featureData(gse)@data$ENTREZID)
names(gid) <- rownames(exprs(gse))
ugid <- unique(gid)
names(ugid) <- paste("geneid", ugid, sep=".")
exprs.matrix <- t(exprs(gse))
rr <- genefu::geneid.map(geneid1=gid, data1=exprs.matrix, geneid2=ugid)
exprs.matrix <- exprs.matrix[ , match(names(rr$geneid1),colnames(exprs.matrix)), drop=FALSE]
index <- match(names(rr$geneid1),names(gid))
gene.id <- gid[index]
gene.id2 <- sapply(gene.id, function(x){strsplit(x, " ///")[[1]][1]})
gene.id3 <- paste("geneid",gene.id2,sep=".")
colnames(exprs.matrix) <- gene.id3
exprs(gse) <- t(exprs.matrix)
gse_output <- gse
return(gse_output)
}