# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Performs elnet with s = 1
#'
#' @param lambda1 lambda
#' @param r correlations
#' @param inv_Sb the inverse of the variance-covariance matrix of genetic effects
#' @param inv_Ss the inverse of the residual variance matrix
#' @param x beta coef
#' @param thr threshold
#' @param yhat a vector
#' @param trace if >1 displays the current iteration
#' @param maxiter maximal number of iterations
#' @param sample_size
#' @return conv
NULL
#' Runs elnet with various parameters
#'
#' @param lambda1 a vector of lambdas (lambda2 is 0)
#' @param fileName the file name of the reference panel
#' @param cor a matrix of correlations, rows represent phenotypes, and columns represent SNPs
#' @param inv_Sb the inverse of the variance-covariance matrix of genetic effects
#' @param inv_Ss the inverse of the residual variance matrix
#' @param N number of subjects
#' @param P number of position in reference file
#' @param col_skip_posR which variants should we skip
#' @param col_skipR which variants should we skip
#' @param keepbytesR required to read the PLINK file
#' @param keepoffsetR required to read the PLINK file
#' @param thr threshold
#' @param init a numeric matrix of beta coefficients
#' @param trace if >1 displays the current iteration
#' @param maxiter maximal number of iterations
#' @param Constant a constant to multiply the standardized genotype matrix
#' @return a list of results
#' @keywords internal
#'
NULL
#' Runs elnet_s1 with various parameters
#'
#' @param lambda1 a vector of lambdas
#' @param cor a matrix of correlations, rows represent phenotypes, and columns represent SNPs
#' @param inv_Sb the inverse of the variance-covariance matrix of genetic effects
#' @param inv_Ss the inverse of the residual variance matrix
#' @param thr threshold
#' @param init a numeric matrix of beta coefficients
#' @param trace if >1 displays the current iteration
#' @param maxiter maximal number of iterations
#' @return a list of results
#' @keywords internal
#'
NULL
#' Count number of lines in a text file
#'
#' @param fileName Name of file
#' @keywords internal
#'
countlines <- function(fileName) {
.Call(`_multivariateLassosum_countlines`, fileName)
}
#' Multiply genotypeMatrix by a matrix
#'
#' @param fileName location of bam file
#' @param N number of subjects
#' @param P number of positions
#' @param input the matrix
#' @param col_skip_pos which variants should we skip
#' @param col_skip which variants should we skip
#' @param keepbytes which bytes to keep
#' @param keepoffset what is the offset
#' @return an armadillo genotype matrix
#' @keywords internal
#'
multiBed3 <- function(fileName, N, P, input, col_skip_pos, col_skip, keepbytes, keepoffset, trace) {
.Call(`_multivariateLassosum_multiBed3`, fileName, N, P, input, col_skip_pos, col_skip, keepbytes, keepoffset, trace)
}
#' Multiply genotypeMatrix by a matrix (sparse)
#'
#' @param fileName location of bam file
#' @param N number of subjects
#' @param P number of positions
#' @param input the matrix
#' @param col_skip_pos which variants should we skip
#' @param col_skip which variants should we skip
#' @param keepbytes which bytes to keep
#' @param keepoffset what is the offset
#' @return an armadillo genotype matrix
#' @keywords internal
#'
multiBed3sp <- function(fileName, N, P, beta, nonzeros, colpos, ncol, col_skip_pos, col_skip, keepbytes, keepoffset, trace) {
.Call(`_multivariateLassosum_multiBed3sp`, fileName, N, P, beta, nonzeros, colpos, ncol, col_skip_pos, col_skip, keepbytes, keepoffset, trace)
}
#' Performs elnet
#'
#' @param lambda1 lambda
#' @param lambda2 lambda
#' @param X genotype Matrix
#' @param r correlations
#' @param inv_Sb the inverse of the variance-covariance matrix of genetic effects
#' @param inv_Ss the inverse of the residual variance matrix
#' @param x beta coef
#' @param thr threshold
#' @param yhat a vector
#' @param trace if >1 displays the current iteration
#' @param maxiter maximal number of iterations
#' @param sample_size
#' @return conv
#' @keywords internal
#'
elnet <- function(lambda1, lambda2, diag, X, r, inv_Sb, inv_Ss, weights, thr, x, yhat, trace, maxiter, sample_size) {
.Call(`_multivariateLassosum_elnet`, lambda1, lambda2, diag, X, r, inv_Sb, inv_Ss, weights, thr, x, yhat, trace, maxiter, sample_size)
}
elnet_s1 <- function(lambda1, r, p, q, pq, inv_Sb, inv_Ss, weights, thr, x, trace, maxiter, sample_size) {
.Call(`_multivariateLassosum_elnet_s1`, lambda1, r, p, q, pq, inv_Sb, inv_Ss, weights, thr, x, trace, maxiter, sample_size)
}
repelnet <- function(lambda1, lambda2, diag, X, r, inv_Sb, inv_Ss, weights, thr, x, yhat, trace, maxiter, sample_size, startvec, endvec) {
.Call(`_multivariateLassosum_repelnet`, lambda1, lambda2, diag, X, r, inv_Sb, inv_Ss, weights, thr, x, yhat, trace, maxiter, sample_size, startvec, endvec)
}
#' imports genotypeMatrix
#'
#' @param fileName location of bam file
#' @param N number of subjects
#' @param P number of positions
#' @param col_skip_pos which variants should we skip
#' @param col_skip which variants should we skip
#' @param keepbytes which bytes to keep
#' @param keepoffset what is the offset
#' @return an armadillo genotype matrix
#' @keywords internal
#'
genotypeMatrix <- function(fileName, N, P, col_skip_pos, col_skip, keepbytes, keepoffset, fillmissing) {
.Call(`_multivariateLassosum_genotypeMatrix`, fileName, N, P, col_skip_pos, col_skip, keepbytes, keepoffset, fillmissing)
}
#' normalize genotype matrix
#'
#' @param genotypes a armadillo genotype matrix
#' @return standard deviation
#' @keywords internal
#'
normalize <- function(genotypes) {
.Call(`_multivariateLassosum_normalize`, genotypes)
}
#' We build a function that gives us the correlation matrix of SNPs
#'
#' Correlation matrix of genotype matrix
#'
#' @param genotypes a armadillo genotype matrix
#' @return correlation matrix
#' @keywords internal
#'
Correlation <- function(genotypes) {
.Call(`_multivariateLassosum_Correlation`, genotypes)
}
runElnet <- function(lambda, shrink, fileName, cor, inv_Sb, inv_Ss, N, P, col_skip_pos, col_skip, keepbytes, keepoffset, weights, thr, init, trace, maxiter, sample_size, startvec, endvec) {
.Call(`_multivariateLassosum_runElnet`, lambda, shrink, fileName, cor, inv_Sb, inv_Ss, N, P, col_skip_pos, col_skip, keepbytes, keepoffset, weights, thr, init, trace, maxiter, sample_size, startvec, endvec)
}
runElnet_s1 <- function(lambda, cor, inv_Sb, inv_Ss, weights, thr, init, trace, maxiter, sample_size) {
.Call(`_multivariateLassosum_runElnet_s1`, lambda, cor, inv_Sb, inv_Ss, weights, thr, init, trace, maxiter, sample_size)
}
# Register entry points for exported C++ functions
methods::setLoadAction(function(ns) {
.Call('_multivariateLassosum_RcppExport_registerCCallable', PACKAGE = 'multivariateLassosum')
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.