1 | probeGeneMapping(eset, platform = c("MISC", "GPL8300", "GPL96", "GPL97", "GPL570", "GPL1352"), method = c("variance", "jetset"))
|
eset |
|
platform |
|
method |
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 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (eset, platform = c("MISC", "GPL8300", "GPL96", "GPL97",
"GPL570", "GPL1352"), method = c("variance", "jetset"))
{
require(org.Hs.eg.db)
platform <- match.arg(platform)
method <- match.arg(method)
platf.map <- rbind(c("MISC", "variance", ""), c("GPL8300",
"jetset", "hgu95av2"), c("GPL96", "jetset", "hgu133a"),
c("GPL97", "jetset", "hgu133b"), c("GPL570", "jetset",
"hgu133plus2"), c("GPL1352", "jetset", "u133x3p"))
dimnames(platf.map) <- list(platf.map[, 1], c("platform",
"method", "parameters"))
if (!is.element(method, platf.map[platf.map[, "platform"],
"method"])) {
stop(sprintf("Method %s cannot be applied on platform %s\nUse the following method(s) instead: %s",
method, platform, paste(x = platf.map[platf.map[,
"platform"] == platform, "method"], collapse = ", ")))
}
params <- platf.map[which(platform == platf.map[, "platform"]),
"parameters"]
Biobase::fData(eset) <- Biobase::fData(eset)[, c("ENTREZID",
"SYMBOL"), drop = FALSE]
switch(method, jetset = {
require(jetset.bhk)
js <- jetset.bhk::jscores(chip = params, probeset = rownames(Biobase::exprs(eset)))
js <- js[rownames(Biobase::exprs(eset)), , drop = FALSE]
geneid1 <- as.character(js[, "EntrezID"])
names(geneid1) <- rownames(js)
geneid2 <- sort(unique(geneid1))
names(geneid2) <- paste("geneid", geneid2, sep = ".")
gix1 <- !is.na(geneid1)
gix2 <- !is.na(geneid2)
geneid.common <- intersect(geneid1[gix1], geneid2[gix2])
gg <- names(geneid1)[is.element(geneid1, geneid.common)]
gid <- geneid1[is.element(geneid1, geneid.common)]
gid.dupl <- unique(gid[duplicated(gid)])
gg.dupl <- names(geneid1)[is.element(geneid1, gid.dupl)]
gid.uniq <- gid[!is.element(gid, gid.dupl)]
gg.uniq <- names(geneid1)[is.element(geneid1, gid.uniq)]
js <- data.frame(js, best = FALSE)
js[gg.uniq, "best"] <- TRUE
if (length(gid.dupl) > 0) {
myscore <- js[gg.dupl, "overall"]
myscore <- cbind(probe = gg.dupl, gid = geneid1[gg.dupl],
score = myscore)
myscore <- myscore[order(as.numeric(myscore[, "score"]),
decreasing = TRUE, na.last = TRUE), , drop = FALSE]
myscore <- myscore[!duplicated(myscore[, "gid"]),
, drop = FALSE]
js[myscore[, "probe"], "best"] <- TRUE
}
probes <- rownames(Biobase::exprs(eset))[js[, "best"]]
names(probes) <- paste("geneid", js[js[, "best"], "EntrezID"],
sep = ".")
gid <- js[js[, "best"], "EntrezID"]
gsymb <- js[js[, "best"], "symbol"]
Biobase::exprs(eset) <- Biobase::exprs(eset)[probes,
, drop = FALSE]
rownames(Biobase::exprs(eset)) <- names(probes)
Biobase::featureData(eset)@data <- Biobase::featureData(eset)@data[probes,
, drop = FALSE]
rownames(Biobase::featureData(eset)@data) <- names(probes)
Biobase::featureData(eset)@data[, "ENTREZID"] <- gid
Biobase::featureData(eset)@data[, "SYMBOL"] <- gsymb
}, variance = {
gid <- as.character(Biobase::featureData(eset)@data[,
"ENTREZID"])
names(gid) <- rownames(Biobase::exprs(eset))
ugid <- sort(unique(gid))
rr <- genefu::geneid.map(geneid1 = gid, data1 = t(Biobase::exprs(eset)),
geneid2 = ugid)
probes <- colnames(rr$data1)
names(probes) <- paste("geneid", rr$geneid1, sep = ".")
Biobase::exprs(eset) <- Biobase::exprs(eset)[probes,
, drop = FALSE]
rownames(Biobase::exprs(eset)) <- names(probes)
Biobase::featureData(eset)@data <- Biobase::featureData(eset)@data[probes,
, drop = FALSE]
rownames(Biobase::featureData(eset)@data) <- names(probes)
gs <- toTable(org.Hs.egSYMBOL)
gs <- gs[!duplicated(gs[, "gene_id"]), , drop = FALSE]
rownames(gs) <- gs[, "gene_id"]
gs <- gs[as.character(Biobase::featureData(eset)@data[,
"ENTREZID"]), "symbol"]
Biobase::featureData(eset)@data[, "SYMBOL"] <- as.character(gs)
}, {
stop(sprintf("Unknow method for probe-gene mapping for platform %s",
platform))
})
return(eset)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.