Learn R Programming

⚠️There's a newer version (0.6.0) of this package.Take me there.

rsnps

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("devtools")
devtools::install_github("ropensci/rsnps")
library("rsnps")

Search for SNPs in Linkage Disequilibrium

Using the Broad Institute data

tmp <- ld_search("rs420358")
#> Querying SNAP...
#> Querying NCBI for up-to-date SNP annotation information...
#> Done!
head(tmp)
#> $rs420358
#>        Proxy      SNP Distance RSquared DPrime GeneVariant GeneName
#> 4   rs420358 rs420358        0    1.000  1.000  INTERGENIC      N/A
#> 5   rs442418 rs420358      122    1.000  1.000  INTERGENIC      N/A
#> 8   rs718223 rs420358     1168    1.000  1.000  INTERGENIC      N/A
#> 6   rs453604 rs420358     2947    1.000  1.000  INTERGENIC      N/A
#> 3   rs372946 rs420358      -70    0.943  1.000  INTERGENIC      N/A
#> 1 rs10889290 rs420358     3987    0.800  1.000  INTERGENIC      N/A
#> 2 rs10889291 rs420358     4334    0.800  1.000  INTERGENIC      N/A
#> 7  rs4660403 rs420358     7021    0.800  1.000  INTERGENIC      N/A
#>   GeneDescription Major Minor   MAF NObserved marker_NCBI organism_NCBI
#> 4             N/A     C     A 0.167       120    rs420358  Homo sapiens
#> 5             N/A     C     T 0.167       120    rs442418  Homo sapiens
#> 8             N/A     A     G 0.167       120    rs718223  Homo sapiens
#> 6             N/A     A     G 0.167       120    rs453604  Homo sapiens
#> 3             N/A     G     C 0.175       120    rs372946  Homo sapiens
#> 1             N/A     G     A 0.200       120  rs10889290  Homo sapiens
#> 2             N/A     C     T 0.200       120  rs10889291  Homo sapiens
#> 7             N/A     A     G 0.200       120   rs4660403  Homo sapiens
#>   chromosome_NCBI assembly_NCBI alleles_NCBI minor_NCBI maf_NCBI  bp_NCBI
#> 4               1     GRCh38.p2          G/T       <NA>     <NA> 40341239
#> 5               1     GRCh38.p2          A/G          T   0.0723 40341361
#> 8               1     GRCh38.p2          A/G          G   0.0723 40342407
#> 6               1     GRCh38.p2          A/G          G   0.0727 40344186
#> 3               1     GRCh38.p2          C/G       <NA>     <NA> 40341169
#> 1               1     GRCh38.p2          A/G          A   0.0841 40345226
#> 2               1     GRCh38.p2          C/T          T   0.0839 40345573
#> 7               1     GRCh38.p2          A/G          G   0.0827 40348260

Using NCBI dbSNP data

SNPs <- c("rs332", "rs420358", "rs1837253", "rs1209415715", "rs111068718")
ncbi_snp_query(SNPs)
#>         Query Chromosome      Marker          Class Gene   Alleles Major
#> 1       rs332          7 rs121909001         in-del CFTR     -/TTT  <NA>
#> 2    rs420358          1    rs420358            snp <NA>       G,T     G
#> 3   rs1837253          5   rs1837253            snp <NA>       C/T     C
#> 4 rs111068718       <NA> rs111068718 microsatellite <NA> (GT)21/24  <NA>
#>   Minor    MAF        BP AncestralAllele
#> 1  <NA>     NA 117559593            <NA>
#> 2     T     NA  40341239     T,T,T,T,T,T
#> 3     T 0.3822 111066174     T,T,T,T,T,T
#> 4  <NA>     NA        NA            <NA>

Using 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       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"

Meta

By participating in this project you agree to abide by its terms.

Copy Link

Version

Install

install.packages('rsnps')

Monthly Downloads

58

Version

0.2.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Scott Chamberlain

Last Published

November 20th, 2016

Functions in rsnps (0.2.0)

users

Get openSNP users.
read_users

Read in openSNP user files from local storage.
genotypes

Get genotype data for one or multiple users.
tryget

Tryget
swap

Swap Elements in a Vector
phenotypes_byid

Get all known variations and all users sharing that phenotype for one phenotype(-ID).
phenotypes

Get phenotype data for one or multiple users.
rsnps-package

Get SNP (Single-Nucleotide Polymorphism) Data on the Web
split_to_df

Split a Vector of Strings Following a Regular Structure
rsnpsCache

rsnps environment
fetch_genotypes

Download genotype data for a user
download_users

Download openSNP user files.
allphenotypes

Get all phenotypes, their variations, and how many users have data available for a given phenotype.
annotations

Get all phenotypes, their variations, and how many users have data available for a given phenotype.
NCBI_snp_query2

Query NCBI's dbSNP for information on a set of SNPs
LDSearch

Search for SNPs in Linkage Disequilibrium with a set of SNPs
NCBI_snp_query

Query NCBI's dbSNP for information on a set of SNPs
flip

Flip Genotypes
allgensnp

Get genotype data for all users at a particular snp.