1 Retrieval of phastCons30way.UCSC.hg38 genomic scores through AnnotationHub resources

The phastCons30way.UCSC.hg38 package provides metadata for the AnnotationHub resources associated with human phastCons conservation scores calculated from multiple genome alignments of the human genome with 29 other mammal genomes, including 26 primates. The original data can be found at the UCSC download site. Details about how those original data were processed into AnnotationHub resources can be found in the source file:

phastCons30way.UCSC.hg38/scripts/make-metadata_phastCons30way.UCSC.hg38.R

The genomic scores for phastCons30way.UCSC.hg38 can be retrieved using the AnnotationHub, which is a web resource that provides a central location where genomic files (e.g., VCF, bed, wig) and other resources from standard (e.g., UCSC, Ensembl) and distributed sites, can be found. A Bioconductor AnnotationHub web resource creates and manages a local cache of files retrieved by the user, helping with quick and reproducible access.

While the AnnotationHub API can be used to query those resources, we encourage to use the GenomicScores API, as follows.
The first step to retrieve genomic scores is to check the ones available to download.

availableGScores()
##  [1] "cadd.v1.3.hg19"                    "fitCons.UCSC.hg19"                
##  [3] "linsight.UCSC.hg19"                "mcap.v1.0.hg19"                   
##  [5] "phastCons7way.UCSC.hg38"           "phastCons27way.UCSC.dm6"          
##  [7] "phastCons30way.UCSC.hg38"          "phastCons46wayPlacental.UCSC.hg19"
##  [9] "phastCons46wayPrimates.UCSC.hg19"  "phastCons60way.UCSC.mm10"         
## [11] "phastCons100way.UCSC.hg19"         "phastCons100way.UCSC.hg38"        
## [13] "phyloP60way.UCSC.mm10"             "phyloP100way.UCSC.hg19"           
## [15] "phyloP100way.UCSC.hg38"

The selected resource can be downloaded with the function getGScores(). After the resource is downloaded the first time, the cached copy will enable a quicker retrieval later.

phast <- getGScores("phastCons30way.UCSC.hg38")

Finally, the phastCons score of a particular genomic position is retrieved using the function ‘gscores()’. Please consult the the documentation of the GenomicScores package for details on how to use it.

gscores(phast, GRanges(seqnames="chr22", IRanges(start=50967020:50967025, width=1)))

1.1 Building an annotation package from a GScores object

Retrieving genomic scores through AnnotationHub resources requires an internet connection and we may want to work with such resources offline. For that purpose, we can create ourselves an annotation package, such as phastCons100way.UCSC.hg19, from a GScores object corresponding to a downloaded AnnotationHub resource. To do that we use the function makeGScoresPackage() as follows:

makeGScoresPackage(phast, maintainer="Me <[email protected]>", author="Me", version="1.0.0")
## Creating package in ./phastCons30way.UCSC.hg38

An argument, destDir, which by default points to the current working directory, can be used to change where in the filesystem the package is created. Afterwards, we should still build and install the package via, e.g., R CMD build and R CMD INSTALL, to be able to use it offline.

2 Session information

sessionInfo()
## R version 4.1.1 (2021-08-10)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.3 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.14-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.14-bioc/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] BiocStyle_2.21.4
## 
## loaded via a namespace (and not attached):
##  [1] bookdown_0.24       digest_0.6.28       R6_2.5.1           
##  [4] jsonlite_1.7.2      magrittr_2.0.1      evaluate_0.14      
##  [7] stringi_1.7.5       rlang_0.4.11        jquerylib_0.1.4    
## [10] bslib_0.3.1         rmarkdown_2.11      tools_4.1.1        
## [13] stringr_1.4.0       xfun_0.26           yaml_2.2.1         
## [16] fastmap_1.1.0       compiler_4.1.1      BiocManager_1.30.16
## [19] htmltools_0.5.2     knitr_1.36          sass_0.4.0