README.md

snpR

packageversion CRAN
status 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! It is built primarily to be user-friendly and handle many levels of SNP and sample metadata without the need for complicated file or object management. Please see the example below!

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.

Function Table of Contents

Import:

Utility:

Object Access and Manipulation:

Statistics:

Windows:

Plotting:

Parentage:

Example

snpR is focused on ease-of-use. Primarily, it achieves this via the use of facets, 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)
## 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 overwrite safe. 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")


hemstrow/snpR documentation built on March 20, 2024, 7:03 a.m.