### R code from vignette source 'vignettes/reactome.db/inst/doc/reactome.Rnw'

###################################################
### code chunk number 1: setup0
###################################################
options(continue=" ", prompt="R> ", width=72L)


###################################################
### code chunk number 2: setup
###################################################
library("reactome.db")


###################################################
### code chunk number 3: objects
###################################################
ls("package:reactome.db")


###################################################
### code chunk number 4: Question #1
###################################################
library("reactome.db")


###################################################
### code chunk number 5: QAlisting
###################################################
qcdata = capture.output(reactome())
head(qcdata, 20)


###################################################
### code chunk number 6: mapcounts (eval = FALSE)
###################################################
## reactomeMAPCOUNTS


###################################################
### code chunk number 7: envApiDemo1
###################################################
all_reactomeIds <- ls(reactomePATHID2EXTID)
length(all_reactomeIds)

set.seed(0xa1beef)
reactomeIds <- sample(all_reactomeIds, 3)
reactomeIds


###################################################
### code chunk number 8: envApiDemo2
###################################################
reactomePATHID2EXTID[[reactomeIds[1]]]
reactomePATHID2EXTID$"1163762"

pathwayNames <- unlist(mget(reactomeIds, reactomePATHID2NAME))
pathwayNames


###################################################
### code chunk number 9: helpDemo (eval = FALSE)
###################################################
## ?reactomeEXTID2PATHID


###################################################
### code chunk number 10: getPathwaysForSpecies
###################################################
pathways <- toTable(reactomePATHNAME2ID)
pathwaysSelectedSpecies <- pathways[grep("Homo sapiens: ", iconv(pathways$path_name)), ]


###################################################
### code chunk number 11: Question #2
###################################################
mget(reactomeIds, reactomeREACTOMEID2GO, ifnotfound=NA)[1:2]


###################################################
### code chunk number 12: Question #4
###################################################
count.mappedLkeys(reactomeREACTOMEID2GO)
length(reactomeREACTOMEID2GO) - count.mappedLkeys(reactomeREACTOMEID2GO)
mappedLkeys(reactomeREACTOMEID2GO)[1]
toTable(reactomeREACTOMEID2GO["1008200"])


###################################################
### code chunk number 13: SessionInfo
###################################################
sessionInfo()