Introduction to PANTHER.db

The PANTHER.db package provides a select interface to the compiled PANTHER ontology residing within a SQLite database.

PANTHER.db can be installed from Bioconductor using

if (!requireNamespace("BiocManager")) install.packages("BiocManager")
BiocManager::install("PANTHER.db")

The size of the underlying SQLite database is currently about 500MB and has to be pre downloaded using AnnotationHub as follows

if (!requireNamespace("AnnotationHub")) BiocManager::install("AnnotationHub")
library(AnnotationHub)
ah <- AnnotationHub()
query(ah, "PANTHER.db")[[1]]

Finally PANTHER.db can be loaded with

library(PANTHER.db)

If you already know about the select interface, you can immediately learn about the various methods for this object by just looking at the help page.

help("PANTHER.db")

When you load the PANTHER.db package, it creates a PANTHER.db object. If you look at the object you will see some helpful information about it.

PANTHER.db
## PANTHER.db object:
## | ORGANISMS: AMBTC|ANOCA|ANOPHELES|AQUAE|ARABIDOPSIS|ASHGO|ASPFU|BACCR|BACSU|BACTN|BATDJ|BOVINE|BRADI|BRADU|BRAFL|BRARP|CAEBR|CANAL|CANINE|CHICKEN|CHIMP|CHLAA|CHLRE|CHLTR|CIOIN|CITSI|CLOBH|COELICOLOR|COXBU|CRYNJ|CUCSA|DAPPU|DEIRA|DICDI|DICPU|DICTD|ECOLI|EMENI|ENTHI|ERYGU|FELCA|FLY|FUSNN|GEOSL|GIAIC|GLOVI|GORGO|GOSHI|HAEIN|HALSA|HELAN|HELPY|HELRO|HORSE|HORVV|HUMAN|IXOSC|KORCO|LEIMA|LEPIN|LEPOC|LISMO|MAIZE|MALARIA|MEDTR|METAC|METJA|MONBE|MONDO|MOUSE|MUSAM|MYCGE|MYCTU|NEIMB|NEMVE|NEUCR|NITMS|ORNAN|ORYLA|ORYSJ|OSTTA|PARTE|PHANO|PHODC|PHYPA|PHYRM|PIG|POPTR|PRIPA|PRUPE|PSEAE|PUCGT|PYRAE|RAT|RHESUS|RHOBA|RICCO|SALTY|SCHPO|SCLS1|SETIT|SHEON|SOLLC|SORBI|SOYBN|STAA8|STRPU|STRR6|SULSO|SYNY3|THAPS|THECC|THEKO|THEMA|THEYD|TOBAC|TRIAD|TRICA|TRIVA|TRYB2|USTMA|VIBCH|VITVI|WHEAT|WORM|XANCP|XENOPUS|YARLI|YEAST|YERPE|ZEBRAFISH|ZOSMR
## | PANTHERVERSION: 14.1
## | PANTHERSOURCEURL: ftp.pantherdb.org
## | PANTHERSOURCEDATE: 2019-Oct14
## | package: AnnotationDbi
## | Db type: PANTHER.db
## | DBSCHEMA: PANTHER_DB
## | DBSCHEMAVERSION: 2.1
## | UNIPROT to ENTREZ mapping: 2019-Oct14

By default, you can see that the PANTHER.db object is set to retrieve records from the various organisms supported by http://pantherdb.org. Methods are provided to restrict all queries to a specific organism. In order to change it, you first need to look up the appropriate organism identifier for the organism that you are interested in. The PANTHER gene ontology is based on the Uniprot reference proteome set. In order to display the choices, we have provided the helper function availablePthOrganisms which will list all the supported organisms along with their Uniprot organism name and taxonomy ids:

availablePthOrganisms(PANTHER.db)[1:5,]
##   AnnotationDbi Species PANTHER Species Genome Source Genome Date
## 1                 HUMAN           HUMAN          HGNC     2018-04
## 2                 MOUSE           MOUSE           MGI     2018-04
## 3                   RAT             RAT           RGD     2018-04
## 4               CHICKEN           CHICK       Ensembl     2018-04
## 5             ZEBRAFISH           DANRE          ZFIN     2018-04
##   UNIPROT Species ID UNIPROT Species Name UNIPROT Taxon ID
## 1              HUMAN         Homo sapiens             9606
## 2              MOUSE         Mus musculus            10090
## 3                RAT    Rattus norvegicus            10116
## 4              CHICK        Gallus gallus             9031
## 5              DANRE          Danio rerio             7955

Once you have learned the PANTHER organism name for the organism of interest, you can then change the organism for the PANTHER.db object:

pthOrganisms(PANTHER.db) <- "HUMAN"
PANTHER.db
## PANTHER.db object:
## | ORGANISMS: HUMAN
## | PANTHERVERSION: 14.1
## | PANTHERSOURCEURL: ftp.pantherdb.org
## | PANTHERSOURCEDATE: 2019-Oct14
## | package: AnnotationDbi
## | Db type: PANTHER.db
## | DBSCHEMA: PANTHER_DB
## | DBSCHEMAVERSION: 2.1
## | UNIPROT to ENTREZ mapping: 2019-Oct14
resetPthOrganisms(PANTHER.db)
PANTHER.db
## PANTHER.db object:
## | ORGANISMS: AMBTC|ANOCA|ANOPHELES|AQUAE|ARABIDOPSIS|ASHGO|ASPFU|BACCR|BACSU|BACTN|BATDJ|BOVINE|BRADI|BRADU|BRAFL|BRARP|CAEBR|CANAL|CANINE|CHICKEN|CHIMP|CHLAA|CHLRE|CHLTR|CIOIN|CITSI|CLOBH|COELICOLOR|COXBU|CRYNJ|CUCSA|DAPPU|DEIRA|DICDI|DICPU|DICTD|ECOLI|EMENI|ENTHI|ERYGU|FELCA|FLY|FUSNN|GEOSL|GIAIC|GLOVI|GORGO|GOSHI|HAEIN|HALSA|HELAN|HELPY|HELRO|HORSE|HORVV|HUMAN|IXOSC|KORCO|LEIMA|LEPIN|LEPOC|LISMO|MAIZE|MALARIA|MEDTR|METAC|METJA|MONBE|MONDO|MOUSE|MUSAM|MYCGE|MYCTU|NEIMB|NEMVE|NEUCR|NITMS|ORNAN|ORYLA|ORYSJ|OSTTA|PARTE|PHANO|PHODC|PHYPA|PHYRM|PIG|POPTR|PRIPA|PRUPE|PSEAE|PUCGT|PYRAE|RAT|RHESUS|RHOBA|RICCO|SALTY|SCHPO|SCLS1|SETIT|SHEON|SOLLC|SORBI|SOYBN|STAA8|STRPU|STRR6|SULSO|SYNY3|THAPS|THECC|THEKO|THEMA|THEYD|TOBAC|TRIAD|TRICA|TRIVA|TRYB2|USTMA|VIBCH|VITVI|WHEAT|WORM|XANCP|XENOPUS|YARLI|YEAST|YERPE|ZEBRAFISH|ZOSMR
## | PANTHERVERSION: 14.1
## | PANTHERSOURCEURL: ftp.pantherdb.org
## | PANTHERSOURCEDATE: 2019-Oct14
## | package: AnnotationDbi
## | Db type: PANTHER.db
## | DBSCHEMA: PANTHER_DB
## | DBSCHEMAVERSION: 2.1
## | UNIPROT to ENTREZ mapping: 2019-Oct14

As you can see, organisms are now restricted to Homo sapiens. To display all data which can be returned from a select query, the columns method can be used:

columns(PANTHER.db)
##  [1] "CLASS_ID"        "CLASS_TERM"      "COMPONENT_ID"    "COMPONENT_TERM" 
##  [5] "CONFIDENCE_CODE" "ENTREZ"          "EVIDENCE"        "EVIDENCE_TYPE"  
##  [9] "FAMILY_ID"       "FAMILY_TERM"     "GOSLIM_ID"       "GOSLIM_TERM"    
## [13] "PATHWAY_ID"      "PATHWAY_TERM"    "SPECIES"         "SUBFAMILY_TERM" 
## [17] "UNIPROT"

Some of these fields can also be used as keytypes:

keytypes(PANTHER.db)
## [1] "CLASS_ID"     "COMPONENT_ID" "ENTREZ"       "FAMILY_ID"    "GOSLIM_ID"   
## [6] "PATHWAY_ID"   "SPECIES"      "UNIPROT"

It is also possible to display all possible keys of a table for any keytype. If keytype is unspecified, the FAMILY_ID will be returned.

go_ids <- head(keys(PANTHER.db,keytype="GOSLIM_ID"))
go_ids
## [1] "GO:0000002" "GO:0000003" "GO:0000014" "GO:0000018" "GO:0000027"
## [6] "GO:0000030"

Finally, you can loop up whatever combinations of columns, keytypes and keys that you need when using select or mapIds.

cols <- "CLASS_ID"
res <- mapIds(PANTHER.db, keys=go_ids, column=cols, keytype="GOSLIM_ID", multiVals="list")
lengths(res)
## GO:0000002 GO:0000003 GO:0000014 GO:0000018 GO:0000027 GO:0000030 
##         10         64          6          8          4          5
res_inner <- select(PANTHER.db, keys=go_ids, columns=cols, keytype="GOSLIM_ID")
nrow(res_inner)
## [1] 97
tail(res_inner)
##       GOSLIM_ID CLASS_ID
## 1322 GO:0000027  PC00170
## 1368 GO:0000030  PC00111
## 1369 GO:0000030  PC00220
## 1378 GO:0000030  PC00092
## 1379 GO:0000030  PC00198
## 1380 GO:0000030  PC00176

By default, all tables will be joined using the central table with PANTHER family IDs by an inner join. Therefore all rows without an associated PANTHER family ID will be removed from the output. To include all results with an associated PANTHER family ID, the argument jointype of the select function must be set to left.

res_left <- select(PANTHER.db, keys=go_ids, columns=cols,keytype="GOSLIM_ID", jointype="left")
nrow(res_left)
## [1] 1978
tail(res_left)
##       GOSLIM_ID     FAMILY_ID CLASS_ID
## 1973 GO:0000030 PTHR43398:SF2  PC00220
## 1974 GO:0000030 PTHR43398:SF3  PC00111
## 1975 GO:0000030 PTHR43398:SF3  PC00220
## 1976 GO:0000030 PTHR45918:SF2     <NA>
## 1977 GO:0000030     PTHR45919     <NA>
## 1978 GO:0000030 PTHR45919:SF1     <NA>

To access the PANTHER Protein Class ontology tree structure, the method traverseClassTree can be used:

term <- "PC00209"
select(PANTHER.db,term, "CLASS_TERM","CLASS_ID")
##   CLASS_ID     CLASS_TERM
## 1  PC00209 sodium channel
ancestors <- traverseClassTree(PANTHER.db,term,scope="ANCESTOR")
select(PANTHER.db,ancestors, "CLASS_TERM","CLASS_ID")
##     CLASS_ID  CLASS_TERM
## 1    PC00133 ion channel
## 703  PC00227 transporter
parents <- traverseClassTree(PANTHER.db,term,scope="PARENT")
select(PANTHER.db,parents, "CLASS_TERM","CLASS_ID")
##   CLASS_ID  CLASS_TERM
## 1  PC00133 ion channel
children <- traverseClassTree(PANTHER.db,term,scope="CHILD")
select(PANTHER.db,children, "CLASS_TERM","CLASS_ID")
##   CLASS_ID                   CLASS_TERM
## 1  PC00243 voltage-gated sodium channel
offspring <- traverseClassTree(PANTHER.db,term,scope="OFFSPRING")
select(PANTHER.db,offspring, "CLASS_TERM","CLASS_ID")
##   CLASS_ID                   CLASS_TERM
## 1  PC00243 voltage-gated sodium channel

SessionInfo

sessionInfo()
## R version 3.6.1 Patched (2019-10-31 r77349)
## Platform: x86_64-apple-darwin17.7.0 (64-bit)
## Running under: macOS High Sierra 10.13.6
## 
## Matrix products: default
## BLAS:   /Users/ka36530_ca/R-stuff/bin/R-3-6/lib/libRblas.dylib
## LAPACK: /Users/ka36530_ca/R-stuff/bin/R-3-6/lib/libRlapack.dylib
## 
## locale:
## [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] parallel  stats4    stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] PANTHER.db_1.0.10    RSQLite_2.1.2        AnnotationHub_2.18.0
##  [4] BiocFileCache_1.10.2 dbplyr_1.4.2         AnnotationDbi_1.48.0
##  [7] IRanges_2.20.0       S4Vectors_0.24.0     Biobase_2.46.0      
## [10] BiocGenerics_0.32.0  BiocStyle_2.14.0    
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.3                    later_1.0.0                  
##  [3] compiler_3.6.1                pillar_1.4.2                 
##  [5] BiocManager_1.30.9            tools_3.6.1                  
##  [7] zeallot_0.1.0                 digest_0.6.22                
##  [9] bit_1.1-14                    evaluate_0.14                
## [11] memoise_1.1.0                 tibble_2.1.3                 
## [13] pkgconfig_2.0.3               rlang_0.4.1                  
## [15] shiny_1.4.0                   DBI_1.0.0                    
## [17] curl_4.2                      yaml_2.2.0                   
## [19] xfun_0.11                     fastmap_1.0.1                
## [21] httr_1.4.1                    stringr_1.4.0                
## [23] dplyr_0.8.3                   knitr_1.26                   
## [25] rappdirs_0.3.1                vctrs_0.2.0                  
## [27] tidyselect_0.2.5              bit64_0.9-7                  
## [29] glue_1.3.1                    R6_2.4.1                     
## [31] rmarkdown_1.17                bookdown_0.15                
## [33] purrr_0.3.3                   blob_1.2.0                   
## [35] magrittr_1.5                  promises_1.1.0               
## [37] backports_1.1.5               htmltools_0.4.0              
## [39] assertthat_0.2.1              xtable_1.8-4                 
## [41] mime_0.7                      interactiveDisplayBase_1.24.0
## [43] httpuv_1.5.2                  stringi_1.4.3                
## [45] BiocVersion_3.10.1            crayon_1.3.4