Skip to content

cruzpazv/rsnps

 
 

Repository files navigation

rsnps

cran checks R build status Build status codecov.io cran version rstudio mirror downloads

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:

Install

Install from CRAN

install.packages("rsnps")

Or dev version

install.packages("remotes")
remotes::install_github("ropensci/rsnps")
library("rsnps")

Usage

NCBI dbSNP data

By default, will be version GRCh38:

snps <- c("rs332", "rs420358", "rs1837253", "rs1209415715", "rs111068718")
ncbi_snp_query(snps)
#> # A tibble: 4 × 16
#>   query        chromosome        bp class rsid   gene   alleles ancestral_allele
#>   <chr>        <chr>          <dbl> <chr> <chr>  <chr>  <chr>   <chr>           
#> 1 rs332        7          117559593 del   rs121… "CFTR… TTT, d… TTT             
#> 2 rs420358     1           40341239 snv   rs420… ""     A,C,G,T A               
#> 3 rs1837253    5          111066174 snv   rs183… ""     T,C     T               
#> 4 rs1209415715 9           41782316 snv   rs120… ""     T,A,C   T               
#> # … with 8 more variables: variation_allele <chr>, seqname <chr>, hgvs <chr>,
#> #   assembly <chr>, ref_seq <chr>, minor <chr>, maf <dbl>,
#> #   maf_population <list>

For version GRCh37:

snps <- c("rs332", "rs420358", "rs1837253", "rs1209415715", "rs111068718")
ncbi_snp_query(snps, "37")
#> A tibble: 4 x 16
#> query     chromosome     bp class rsid  gene  alleles ancestral_allele variation_allele seqname hgvs assembly ref_seq
#> <chr>     <chr>       <dbl> <chr> <chr> <chr> <chr>   <chr>            <chr>            <chr>   <chr> <chr>    <chr>  
#> 1 rs332     7          1.17e8 del   rs12~ "CFT~ TTT, d~ TTT              delTTT           NC_000~ NC_0~ GRCh37.~ NA     
#> 2 rs420358  1          4.08e7 snv   rs42~ ""    A,C,G,T A                C,G,T            NC_000~ NC_0~ GRCh37.~ NA     
#> 3 rs1837253 5          1.10e8 snv   rs18~ ""    T,C     T                C                NC_000~ NC_0~ GRCh37.~ T      
#>4 rs120941~ 9          4.72e7 snv   rs12~ ""    T,A,C   T                A,C              NC_000~ NC_0~ GRCh37.~ NA     
#> # ... with 3 more variables: minor <chr>, maf <dbl>, maf_population <list>

openSNP data

genotypes() function

genotypes('rs9939609', userid='1,6,8', df=TRUE)
#>    snp_name snp_chromosome snp_position                 user_name user_id
#> 1 rs9939609             16     53786615 Bastian Greshake Tzovaras       1
#> 2 rs9939609             16     53786615              Nash Parovoz       6
#> 3 rs9939609             16     53786615         Samantha B. Clark       8
#>   genotype_id genotype
#> 1           9       AT
#> 2           5       AT
#> 3           2       TT

phenotypes() function

out <- phenotypes(userid=1)
out$phenotypes$`Hair Type`
#> $phenotype_id
#> [1] 16
#> 
#> $variation
#> [1] "straight"

For more detail, see the vignette: rsnps tutorial.

Meta

  • Please report any issues or bugs.
  • 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. By contributing to this project, you agree to abide by its terms.

ropensci_footer

About

Wrapper to a number of SNP web APIs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • R 100.0%