g2_snps: Estimating g2 from larger datasets, such as SNPs

Description Usage Arguments Details Value Author(s) References Examples

View source: R/g2_snps.R

Description

Estimating g2 from larger datasets, such as SNPs

Usage

1
2
g2_snps(genotypes, nperm = 0, nboot = 0, boot_over = "inds", CI = 0.95,
  parallel = FALSE, ncores = NULL, verbose = TRUE)

Arguments

genotypes

data.frame with individuals in rows and loci in columns, containing genotypes coded as 0 (homozygote), 1 (heterozygote) and NA (missing)

nperm

number or permutations for to estimate a p-value

nboot

number of bootstraps to estimate a confidence interval

boot_over

Bootstrap over individuals by specifying "inds" and over loci with "loci". Defaults to "ind".

CI

confidence interval (default to 0.95)

parallel

Default is FALSE. If TRUE, bootstrapping and permutation tests are parallelized

ncores

Specify number of cores to use for parallelization. By default, all available cores are used.

verbose

If FALSE, nothing will be printed to show the status of bootstraps and permutations.

Details

Calculates g2 from SNP datasets. Use convert_raw to convert raw genotypes (with 2 columns per locus) into the required format

Value

g2_snps returns an object of class "inbreed". The functions 'print' and 'plot' are used to print a summary and to plot the distribution of bootstrapped g2 values and CI.

An 'inbreed' object from g2_snps is a list containing the following components:

call

function call.

g2

g2 value

p_val

p value from permutation test

g2_permut

g2 values from permuted genotypes

g2_boot

g2 values from bootstrap samples

CI_boot

confidence interval from bootstrap distribution

se_boot

standard error of g2 from bootstraps

nobs

number of observations

nloc

number of markers

Author(s)

Martin A. Stoffel (martin.adam.stoffel@gmail.com) & Mareike Esser (messer@techfak.uni-bielefeld.de)

References

Hoffman, J.I., Simpson, F., David, P., Rijks, J.M., Kuiken, T., Thorne, M.A.S., Lacey, R.C. & Dasmahapatra, K.K. (2014) High-throughput sequencing reveals inbreeding depression in a natural population. Proceedings of the National Academy of Sciences of the United States of America, 111: 3775-3780. Doi: 10.1073/pnas.1318945111

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# load SNP genotypes in 0 (homozygous), 1 (heterozygous), NA (missing) format.
# low number of bootstraps and permutations for computational reasons.
data(mouse_snps)
(g2_mouse <- g2_snps(mouse_snps, nperm = 10, nboot = 10, CI = 0.95, boot_over = "loci"))

# parallelized version for more bootstraps or permutations
## Not run: 
(g2_mouse <- g2_snps(mouse_snps, nperm = 1000, nboot = 1000, 
                     CI = 0.95, parallel = TRUE, ncores = 4))

## End(Not run)

inbreedR documentation built on Feb. 2, 2022, 5:09 p.m.