Function to write a binary GRM format recently introduced by GCTA. It takes a correlation matrix as used by other Kriging functions, and writes three files: binary file for storing the diagonal + lower triangular elements, a text file for sample IDs, and a binary file storing the number of SNPs used in the correlation matrix calculation.
okriging
(Package: OmicKriging) :
Run omic kriging on a set of correlation matrices and a given phenotype.
Universal kriging formula: lambda' = ( c + X m )' iSig m' = ( x - X' iSig c )' ( X' iSig X )^-1 m' = ( t(x) - c' iSig X ) ( X' iSig X )^-1 lambda' = (c' + m' X) iSig x: #covariates x ntest X: ntrain x #cov c: ntrain x ntest
This function computes a gene expression correlation matrix given a file of transcript expression levels for each sample in the study. It returns a correlation matrix with rownames and colnames as sample IDs.
make_PCs_irlba
(Package: OmicKriging) :
Run Principal Component Analysis (PCA) using the irlba package.
A simple wrapper around the irlba() function which computes a partial SVD efficiently. This function's run time depends on the number of eigenvectors requested but scales well. Use this function to generate covariates for use with the okriging or krigr_cross_validation functions.
This function loads a file into a data frame. This file should contain one row per sample in your study, and one column for each covariate and phenotype of interest. Additionally, it requires a header with "IID" for the column of sample IDs, and a unique name for each phenotype and covariate.
This is a flexible cross validation routine which wraps the Omic Kriging calculation. The user can specify the size of the test set, all the way to "Leave One Out" cross validation. Additionally, all relevant parameters in the okriging function are exposed. This function uses the doParallel package to distribute computation over multiple cores. If the phenotype is case/control, a ROCR AUC and GLM analysis is run and the results printed to screen.
Function provided by GCTA maintainers (modified slightly) for accessing their recently introduced binary GRM format. The GRM is stored as a vector of numerics which correspond to the lower triangular elements including the diagonal. We simply read these, pull the diagonal elements, and inflate them into a full symmetric matrix. We add sample IDs to colnames and rownames for compatibility with other Kriging functions.
make_PCs_svd
(Package: OmicKriging) :
Run Principal Component Analysis (PCA) using base R svd() function.
A simple wrapper around the base R svd() function which returns the top N eigenvectors of a matrix. Use this function to generate covariates for use with the okriging or krigr_cross_validation functions. This wrapper preserves the rownames of the original matrix.