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