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
)
Arguments
- Glist
A list containing information about the genotype matrix stored on disk.
- task
A character string specifying the task to perform. Possible tasks are "prepare" (default), "sparseld", "ldscores", "ldsets", and "geneticmap".
- study
The name of the study.
- fnBED
Path and filename of the .bed binary file used to store genotypes on disk.
- ldfiles
Path and filename of the .ld binary files used for storing the sparse LD matrix on disk.
- bedfiles
A vector of filenames for the PLINK bed-files.
- bimfiles
A vector of filenames for the PLINK bim-files.
- famfiles
A vector of filenames for the PLINK fam-files.
- mapfiles
A vector of filenames for the mapfiles.
- ids
A vector of individual identifiers used in the study.
- rsids
A vector of marker rsids used in the study.
- assembly
Character string indicating the name of the assembly.
- overwrite
A logical value; if TRUE, the binary genotype/LD file will be overwritten.
- msize
Number of markers used in the computation of sparseld.
- r2
A threshold value (more context might be beneficial, e.g., threshold for what?).
- kb
Size of the genomic region in kilobases (kb).
- cm
Size of the genomic region in centimorgans (cm).
- ncores
Number of processing cores to be used for genotype processing.
Examples
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)