###################################################
### chunk number 1: setup
###################################################
options(width=45, digits=2)
library(affycoretools)
library(hgfocus.db)
library(org.Hs.eg.db)
library(illuminaHumanv3ProbeID.db)


###################################################
### chunk number 2:  eval=FALSE
###################################################
## ls("package:hgfocus.db")


###################################################
### chunk number 3: 
###################################################
head(ls("package:hgfocus.db"), n = 10)


###################################################
### chunk number 4:  eval=FALSE
###################################################
## ?hgfocusUNIGENE


###################################################
### chunk number 5:  eval=FALSE
###################################################
## ?hgfocusUNIGENE
## head(toTable(hgfocusUNIGENE))


###################################################
### chunk number 6:  eval=FALSE
###################################################
## ?hgfocusUNIGENE
## head(toTable(hgfocusUNIGENE))


###################################################
### chunk number 7: 
###################################################
head(toTable(hgfocusUNIGENE))


###################################################
### chunk number 8:  eval=FALSE
###################################################
## get("1010243", illuminaHumanv3ProbeIDGENENAME)


###################################################
### chunk number 9:  eval=FALSE
###################################################
## get("1010243", illuminaHumanv3ProbeIDGENENAME)


###################################################
### chunk number 10: 
###################################################
get("1010243", illuminaHumanv3ProbeIDGENENAME)


###################################################
### chunk number 11:  eval=FALSE
###################################################
## illumina <- c("10008", "10010", "10017", "10019")
## mget(illumina, illuminaHumanv3ProbeIDGENENAME)


###################################################
### chunk number 12:  eval=FALSE
###################################################
## illumina <- c("10008", "10010", "10017", "10019")
## mget(illumina, illuminaHumanv3ProbeIDGENENAME)


###################################################
### chunk number 13: 
###################################################
illumina <- c("10008", "10010", "10017", "10019")
mget(illumina, illuminaHumanv3ProbeIDGENENAME)


###################################################
### chunk number 14:  eval=FALSE
###################################################
## library(KEGG)
## get("Caffeine metabolism", revmap(KEGGPATHID2NAME))


###################################################
### chunk number 15:  eval=FALSE
###################################################
## library(KEGG)
## get("Caffeine metabolism", revmap(KEGGPATHID2NAME))


###################################################
### chunk number 16: 
###################################################
get("Caffeine metabolism", revmap(KEGGPATHID2NAME))


###################################################
### chunk number 17:  eval=FALSE
###################################################
## library(KEGG)
## get("Caffeine metabolism", revmap(KEGGPATHID2NAME))


###################################################
### chunk number 18: 
###################################################
get("Caffeine metabolism", revmap(KEGGPATHID2NAME))


###################################################
### chunk number 19:  eval=FALSE
###################################################
## get("00232", revmap(hgfocusPATH))


###################################################
### chunk number 20:  eval=FALSE
###################################################
## library(KEGG)
## get("Caffeine metabolism", revmap(KEGGPATHID2NAME))


###################################################
### chunk number 21: 
###################################################
get("Caffeine metabolism", revmap(KEGGPATHID2NAME))


###################################################
### chunk number 22:  eval=FALSE
###################################################
## get("00232", revmap(hgfocusPATH))


###################################################
### chunk number 23: 
###################################################
get("00232", revmap(hgfocusPATH))


###################################################
### chunk number 24: 
###################################################
get("1234", org.Hs.egSYMBOL)


###################################################
### chunk number 25: 
###################################################
get("1234", org.Hs.egSYMBOL)


###################################################
### chunk number 26: 
###################################################
get("1234", org.Hs.egGENENAME)


###################################################
### chunk number 27: 
###################################################
get("1234", org.Hs.egSYMBOL)


###################################################
### chunk number 28: 
###################################################
get("1234", org.Hs.egGENENAME)


###################################################
### chunk number 29: 
###################################################
caff <- get("Caffeine metabolism", 
            revmap(KEGGPATHID2NAME))
get(caff, revmap(org.Hs.egPATH))


###################################################
### chunk number 30:  eval=FALSE
###################################################
## library(biomaRt)
## listMarts()


###################################################
### chunk number 31:  eval=FALSE
###################################################
## library(biomaRt)
## listMarts()


###################################################
### chunk number 32: 
###################################################
library(biomaRt)
listMarts()[,2]


###################################################
### chunk number 33: 
###################################################
mart <- useMart("ensembl")


###################################################
### chunk number 34:  eval=FALSE
###################################################
## listDatasets(mart)


###################################################
### chunk number 35:  eval=FALSE
###################################################
## mart <- useMart("ensembl")


###################################################
### chunk number 36:  eval=FALSE
###################################################
## listDatasets(mart)


###################################################
### chunk number 37: 
###################################################
listDatasets(mart)[,1]


###################################################
### chunk number 38: 
###################################################
mart <- useMart("ensembl", "hsapiens_gene_ensembl")


###################################################
### chunk number 39:  eval=FALSE
###################################################
## listAttributes(mart)


###################################################
### chunk number 40: 
###################################################
head(listAttributes(mart))


###################################################
### chunk number 41:  eval=FALSE
###################################################
## listFilters(mart)


###################################################
### chunk number 42: 
###################################################
head(listFilters(mart))


###################################################
### chunk number 43:  eval=FALSE
###################################################
## getBM(attributes = c("affy_hg_u133a", "entrezgene"),
##       filters = "affy_hg_u133a", 
##       values = "1007_s_at",
##       mart = mart)


###################################################
### chunk number 44:  eval=FALSE
###################################################
## getBM(attributes = c("affy_hg_u133a", "entrezgene"),
##       filters = "affy_hg_u133a", 
##       values = "1007_s_at",
##       mart = mart)


###################################################
### chunk number 45: 
###################################################
getBM(attributes = c("affy_hg_u133a", "entrezgene"),
      filters = "affy_hg_u133a", 
      values = "1007_s_at",
      mart = mart)


###################################################
### chunk number 46: 
###################################################
getBM(c("ensembl_gene_id", "description"),
      "ensembl_gene_id", "ENSG00000112715",
      mart)


###################################################
### chunk number 47: 
###################################################
getBM(c("ensembl_gene_id","chromosome_name"),
      "ensembl_gene_id", "ENSG00000112715",
      mart)


###################################################
### chunk number 48: 
###################################################
getBM(c("sequence_gene_chrom_start",
        "sequence_gene_chrom_end",
        "ensembl_gene_id"),
      "ensembl_gene_id", "ENSG00000112715",
      mart)


###################################################
### chunk number 49: 
###################################################
aaf.handler()


###################################################
### chunk number 50: 
###################################################
library(affycoretools)
load(paste(.path.package("affycoretools"),
           "/doc/exprSet.Rdata", sep=""))
prbs <- featureNames(eset)[500:550]


###################################################
### chunk number 51: 
###################################################
probes2table(eset = eset, probids = prbs,
             lib = "hgfocus.db", text = TRUE,
             filename = "test")


###################################################
### chunk number 52:  eval=FALSE
###################################################
## probes2tableBM(eset = eset, probids = prbs[1:10],
##                species = "hsapiens", 
##                ann.source = "affy_hg_focus",
##                filename = "test2",affyid = TRUE,
##                mysql = FALSE)


