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 genotypes
list of information about genotype matrix stored on disk - only provided if task="summary" or task="sparseld"
character specifying which task to perform ("prepare" is default, "summary", or "sparseld")
name of the study
path and filename of the binary file .bed used for storing genotypes on the disk
path and filename of the binary files .ld for storing sparse ld matrix on the disk
vector of names for the PLINK bed-files
vector of names for the PLINK bim-files
vector of names for the PLINK fam-files
vector of names for the mapfiles
vector of individuals used in the study
vector of marker rsids used in the study
character name of assembly
logical if TRUE overwite binary genotype/ld file
number of markers used in compuation of sparseld
threshold
size of genomic region in kb
size of genomic region in cm
number of cores used to process the genotypes
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