inbreedR (version 0.3.0)

g2_snps: Estimating g2 from larger datasets, such as SNPs

Description

Estimating g2 from larger datasets, such as SNPs

Usage

g2_snps(genotypes, nperm = 0, nboot = 0, CI = 0.95, parallel = FALSE,
  ncores = NULL)

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
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.

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:

  • callfunction call.
  • g2g2 value
  • p_valp value from permutation test
  • g2_permutg2 values from permuted genotypes
  • g2_bootg2 values from bootstrap samples
  • CI_bootconfidence interval from bootstrap distribution
  • se_bootstandard error of g2 from bootstraps
  • nobsnumber of observations
  • nlocnumber of markers

Details

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

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

Run this code
# 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))

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

Run the code above in your browser using DataCamp Workspace