Skip to content

elizeng/snpR

 
 

Repository files navigation

snpR

packageversion CRAN status Codecov test coverage R-CMD-check

snpR is an R package for analyzing call Single Nucleotide Polymorphism (SNP) genotypes containing most basic stats including pairwise LD, gaussian sliding window analysis tools, plotting options, clustering analysis, colony interface, Ne estimation, formatting, filtering, and more!

Installation

snpR can be installed from GitHub:

# install.packages("remotes")
remotes::install_github("hemstrow/snpR")

To install the vignettes as well (recommended for new users), instead use:

remotes::install_github("hemstrow/snpR", build_vignettes = T) # linux
remotes::install_github("hemstrow/snpR", build_vignettes = T, build_opts = c("--no-resave-data", "--no-manual")) # windows

If you wish to try out the latest features or bug fixes, the dev version can be installed from GitHub as well:

# install.packages("remotes")
remotes::install_github("hemstrow/snpR", ref = "dev")

A CRAN version should be available soon.

Example

snpR is focused on ease-of-use. Primarily, it achieves this via the use of , which describe sample or SNP metadata. snpR is built to automatically split up analysis by facet. For example, calculating observed heterozygosity for each population or family, or for each population/family combination is easy!

library(snpR)
#> Loading required package: data.table
#> Loading required package: foreach
## basic example code

x <- calc_ho(stickSNPs, facets = c("pop")) # split by pop (stickSNPs is an example dataset included in snpR)
x <- calc_ho(x, facets = c("fam")) # split by family
x <- calc_ho(x, facets = c("pop.fam")) # split by combinations of family and pop

snpR also facilitates ease-of-use by being . As above, new analyses are added to an existing object. Results can be fetched using the get.snpR.stats handler.

res <- get.snpR.stats(x, facets = "pop", stats = "ho")

Functions in snpR are consistently named: functions that calculate statistics are prefixed calc_, functions that do plots are prefixed plot_, and functions that run external tools (like COLONY), are named run_. Typing snpR::calc into the console on Rstudio will bring up a helpful list of all of the statistical functions!

For a full introduction, check the snpR_introduction vignette.

# remotes::install_github("hemstrow/snpR", build_vignettes = T, build_opts = c("--no-resave-data", "--no-manual"))

vignette("snpR_introduction")

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%