Learn R Programming

qgg (version 1.1.1)

gprep: Prepare genotype data for all statistical analyses (initial step)

Description

All functions in qgg relies on a simple data infrastructure that takes five main input sources; phenotype data (y), covariate data (X), genotype data (G or Glist), a genomic relationship matrix (GRM or GRMlist) and genetic marker sets (sets).

The genotypes are stored in a matrix (n x m (individuals x markers)) in memory (G) or in a binary file on disk (Glist).

It is only for small data sets that the genotype matrix (G) can stored in memory. For large data sets the genotype matrix has to stored in a binary file on disk (Glist). Glist is as a list structure that contains information about the genotypes in the binary file.

The gprep function prepares the Glist, and is required for downstream analyses of large-scale genetic data. Typically, the Glist is prepared once, and saved as an *.Rdata-file.

The gprep function reads genotype information from binary PLINK files, and creates the Glist object that contains general information about the genotypes such as reference alleles, allele frequencies and missing genotypes, and construct a binary file on the disk that contains the genotypes as allele counts of the alternative allele (memory usage = (n x m)/4 bytes).

The gprep function can also be used to prepare sparse ld matrices. The r2 metric used is the pairwise correlation between markers (allele count alternative allele) in a specified region of the genome. The marker genotype is allele count of the alternative allele which is assumed to be centered and scaled.

The Glist structure is used as input parameter for a number of qgg core functions including: 1) construction of genomic relationship matrices (grm), 2) construction of sparse ld matrices, 3) estimating genomic parameters (greml), 4) single marker association analyses (glma), 5) gene set enrichment analyses (gsea), and 6) genomic prediction from genotypes and phenotypes (gsolve) or genotypes and summary statistics (gscore).

Usage

gprep(
  Glist = NULL,
  task = "prepare",
  study = NULL,
  fnBED = NULL,
  ldfiles = NULL,
  bedfiles = NULL,
  bimfiles = NULL,
  famfiles = NULL,
  mapfiles = NULL,
  ids = NULL,
  rsids = NULL,
  assembly = NULL,
  overwrite = FALSE,
  msize = 100,
  r2 = NULL,
  kb = NULL,
  cm = NULL,
  ncores = 1
)

Value

Returns a list structure (Glist) with information about genotypes

Arguments

Glist

list of information about genotype matrix stored on disk - only provided if task="summary" or task="sparseld"

task

character specifying which task to perform ("prepare" is default, "summary", or "sparseld")

study

name of the study

fnBED

path and filename of the binary file .bed used for storing genotypes on the disk

ldfiles

path and filename of the binary files .ld for storing sparse ld matrix on the disk

bedfiles

vector of names for the PLINK bed-files

bimfiles

vector of names for the PLINK bim-files

famfiles

vector of names for the PLINK fam-files

mapfiles

vector of names for the mapfiles

ids

vector of individuals used in the study

rsids

vector of marker rsids used in the study

assembly

character name of assembly

overwrite

logical if TRUE overwite binary genotype/ld file

msize

number of markers used in compuation of sparseld

r2

threshold

kb

size of genomic region in kb

cm

size of genomic region in cm

ncores

number of cores used to process the genotypes

Author

Peter Soerensen

Examples

Run this code

bedfiles <- system.file("extdata", "sample_chr1.bed", package = "qgg")
bimfiles <- system.file("extdata", "sample_chr1.bim", package = "qgg")
famfiles <- system.file("extdata", "sample_chr1.fam", package = "qgg")

Glist <- gprep(study="Example", bedfiles=bedfiles, bimfiles=bimfiles,
             famfiles=famfiles)

Run the code above in your browser using DataLab