---
title: "AlphaMissense.v2023.hg19 AnnotationHub Resource Metadata"
author:
- name: Robert Castelo
  affiliation: 
  - &id Dept. of Medicine and Life Sciences, Universitat Pompeu Fabra, Barcelona, Spain
  email: robert.castelo@upf.edu
package: "`r pkg_ver('AlphaMissense.v2023.hg19')`"
abstract: >
  Store AlphaMissense.v2023.hg19 AnnotationHub Resource Metadata.
vignette: >
  %\VignetteIndexEntry{AlphaMissense.v2023.hg19 AnnotationHub Resource Metadata}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
output: 
  BiocStyle::html_document:
    toc: true
    toc_float: true
    number_sections: true
---

```{r setup, echo=FALSE}
options(width=80)
```

# Retrieval of AlphaMissense.v2023.hg19 pathogenicity scores through AnnotationHub resources

The `AlphaMissense.v2023.hg19` package provides metadata for the
`r Biocpkg("AnnotationHub")` resources associated with human AlphaMissense
pathogenicity scores [@cheng2023accurate]. The original data can be found at
the Google DeepMind download
[site](https://console.cloud.google.com/storage/browser/dm_alphamissense).
Details about how those original data were processed into
`r Biocpkg("AnnotationHub")` resources can be found in the source
file:

```
AlphaMissense.v2023.hg19/scripts/make-metadata_AlphaMissense.v2023.hg19.R
```

The pathogenicity scores for `AlphaMissense.v2023.hg19` can be retrieved using
the `r Biocpkg("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 `r Biocpkg("AnnotationHub")` web
resource creates and manages a local cache of files retrieved by the user,
helping with quick and reproducible access.

While the `r Biocpkg("AnnotationHub")` API can be used to query those resources,
we encourage to use the `r Biocpkg("GenomicScores")` API
[@puigdevall2018genomicscores], as follows. The first step to retrieve genomic
scores is to check the ones available to download.

```{r, echo=FALSE}
avgs <- readRDS(system.file("extdata", "avgs.rds", package="GenomicScores"))
```
```{r retrieve2, message=FALSE, cache=FALSE, eval=FALSE}
library(GenomicScores)

availableGScores()
```
```{r, message=FALSE, cache=FALSE, echo=FALSE}
library(AnnotationHub)
library(GenomicScores)
setAnnotationHubOption("MAX_DOWNLOADS", 30)
avgs
```

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. In this case, because AlphaMissense
scores are distributed under a
[CC BY-NC-SA 4.0](https://github.com/google-deepmind/alphamissense#alphamissense-predictions-license) license, we should add the argument
`accept.license=TRUE` to non-interactively obtain the data. If we
do call `getGScores()` interactively without that argument, the function
will ask us to accept the license.

```{r retrieve3, message=FALSE, cache=FALSE}
am23 <- getGScores("AlphaMissense.v2023.hg19", accept.license=TRUE)
am23
citation(am23)
```

Finally, the AlphaMissense pathogenicity score of a particular genomic position
is retrieved using the function 'gscores()'. Please consult the documentation
of the `r Biocpkg("GenomicScores")` package for details on how to use it. For
instance, @cheng2023accurate report likely pathogenic scores for variants in
the human glucose sensor GCK. If we would like to retrieve the AlphaMissense
score of the variant
[NM_000162.5(GCK):c.1174C>T (p.Arg392Cys)](https://www.ncbi.nlm.nih.gov/clinvar/variation/585909),
classified as pathogenic in the ClinVar database, we should call `gscores()`
as follows.


```{r retrieve4, message=FALSE}
gscores(am23, GRanges("chr7:44185175"), ref="C", alt="T")
```

## 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](https://bioconductor.org/packages/phastCons100way.UCSC.hg19),
from a `GScores` object corresponding to a downloaded `AnnotationHub` resource.
To do that we use the function `makeGScoresPackage()` as follows:

```{r eval=FALSE}
makeGScoresPackage(am23, maintainer="Me <me@example.com>", author="Me", version="1.0.0")
```
```{r echo=FALSE}
cat("Creating package in ./AlphaMissense.v2023.hg19\n")
```

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.

# Session information

```{r session_info, cache=FALSE}
sessionInfo()
```

# References
