Learn R Programming

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

rsnps

NOTE

rsnps used to be ropensnp

Install

Install from CRAN

install.packages("rsnps")

Or dev version

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

Data sources

This set of functions/package accesses data from:

Quick start

Search for SNPs in Linkage Disequilibrium

Using the Broad Institute data

tmp <- LDSearch("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 Chromosome_NCBI Marker_NCBI
#> 4             N/A     C     A 0.167       120               1    rs420358
#> 5             N/A     C     T 0.167       120               1    rs442418
#> 8             N/A     A     G 0.167       120               1    rs718223
#> 6             N/A     A     G 0.167       120               1    rs453604
#> 3             N/A     G     C 0.175       120               1    rs372946
#> 1             N/A     G     A 0.200       120               1  rs10889290
#> 2             N/A     C     T 0.200       120               1  rs10889291
#> 7             N/A     A     G 0.200       120               1   rs4660403
#>   Class_NCBI Gene_NCBI Alleles_NCBI Major_NCBI Minor_NCBI MAF_NCBI
#> 4        snp      <NA>          G,T          G          T       NA
#> 5        snp      <NA>          A/G          A          G   0.0723
#> 8        snp      <NA>          A/G          A          G   0.0723
#> 6        snp      <NA>          A/G          A          G   0.0727
#> 3        snp      <NA>          C,G          C          G       NA
#> 1        snp      <NA>          A/G          G          A   0.0841
#> 2        snp      <NA>          C/T          C          T   0.0839
#> 7        snp      <NA>          A/G          A          G   0.0827
#>    BP_NCBI
#> 4 40341238
#> 5 40341360
#> 8 40342406
#> 6 40344185
#> 3 40341168
#> 1 40345225
#> 2 40345572
#> 7 40348259

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
#> 1  <NA>     NA 117559592
#> 2     T     NA  40341238
#> 3     T 0.3822 111066173
#> 4  <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

Copy Link

Version

Install

install.packages('rsnps')

Monthly Downloads

54

Version

0.1.6

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Scott Chamberlain

Last Published

March 3rd, 2015

Functions in rsnps (0.1.6)

phenotypes

Get phenotype data for one or multiple users.
LDSearch

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

Download openSNP user files.
users

Get openSNP users.
tryget

Tryget
read_users

Read in openSNP user files from local storage.
annotations

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

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

Swap Elements in a Vector
allgensnp

Get genotype data for all users at a particular snp.
allphenotypes

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

Flip Genotypes
split_to_df

Split a Vector of Strings Following a Regular Structure
genotypes

Get genotype data for one or multiple users.
NCBI_snp_query

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

rsnps environment
fetch_genotypes

Download genotype data for a user from 23andme or other repo.