An open API service indexing awesome lists of open source software.

https://github.com/ropensci/rsnps

Wrapper to a number of SNP web APIs
https://github.com/ropensci/rsnps

data r r-package rstats snps web-api

Last synced: about 1 month ago
JSON representation

Wrapper to a number of SNP web APIs

Awesome Lists containing this project

README

          

---
output: github_document
---

rsnps
=====

```{r, eval=TRUE, echo=FALSE}
knitr::opts_chunk$set(
warning=FALSE,
message=FALSE,
comment="#>"
)
```

[![R build status](https://github.com/ropensci/rsnps/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/rsnps/actions)
[![Build status](https://ci.appveyor.com/api/projects/status/d2lv98726u6t9ut5/branch/master)](https://ci.appveyor.com/project/sckott/rsnps/branch/master/)
[![Codecov test coverage](https://codecov.io/gh/ropensci/rsnps/branch/master/graph/badge.svg)](https://app.codecov.io/gh/ropensci/rsnps?branch=master)
[![cran version](https://www.r-pkg.org/badges/version/rsnps)](https://cran.r-project.org/package=rsnps)
[![rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/rsnps?color=E664A4)](https://github.com/r-hub/cranlogs.app)

This package gives you access to data from OpenSNP and NCBI's dbSNP SNP database.

## NOTE

`rsnps` used to be `ropensnp`

## Data sources

This set of functions/package accesses data from:

+ openSNP.org
+
+ See documentation on the openSNP API
+ See blog post about their API
+ Relevant functions:
+ `allgensnp()`, `allphenotypes()`, `annotations()`, `download_users()`,
`fetch_genotypes()`, `genotypes()`, `phenotypes()`, `phenotypes_byid()`, `users()`

+ NCBI's dbSNP SNP database
+ See for more details
+ Relevant function:
+ `ncbi_snp_query()`

## Install

Install from CRAN

```{r eval=FALSE}
install.packages("rsnps")
```

Or dev version

```{r eval=FALSE}
install.packages("remotes")
remotes::install_github("ropensci/rsnps")
```

```{r}
library("rsnps")
```

## Usage

### NCBI dbSNP data

```{r}
snps <- c("rs332", "rs420358", "rs1837253", "rs1209415715", "rs111068718")
ncbi_snp_query(snps)
```

The `ncbi_snp_query()` function can be used with an NCBI API which gives access
higher numbers of API requests per second. More information about setting this
up can be found in the package help accessed via `?rsnps`.

### openSNP data

`genotypes()` function

```{r}
genotypes('rs9939609', userid='1,6,8', df=TRUE)
```

`phenotypes()` function

```{r}
out <- phenotypes(userid=1)
out$phenotypes$`Hair Type`
```

For more detail, see the [vignette: rsnps tutorial](https://github.com/ropensci/rsnps/tree/master/vignettes).

## Meta

* Please [report any issues or bugs](https://github.com/ropensci/rsnps/issues/).
* License: MIT
* Get citation information for `rsnsps` in R doing `citation(package = 'rsnps')`
* Please note that this package is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By contributing to this project, you agree to abide by its terms.

[![ropensci_footer](https://ropensci.org/public_images/github_footer.png)](https://ropensci.org)