#' Prediction of type 2 diabetes based on genomic data with deep learning algorithms
#'
#' The function described here makes use of a deep learning model trained using the h2o package to predict type 2 diabetes based on selected SNPs.
#'
#'
#'
#' @title DiabPred
#' @param genofile An object of class \code{SNPGDSFileClass} loaded into the environment with \code{snpgdsOpen} from the \strong{SNPRelate} package.
#'
#' @export DiabPred
#'
#' @return A data frame with individuals in rows and 3 colums:
#' \itemize{
#' \item \code{prediction}: First column with the actual phenotypic output indicating wether the individual is diabetic or non-diabetic.
#' \item \code{non.diabetic}: Probability of the individual being non-diabetic
#' \item \code{diabetic}: Probability of the individual being diabetic.
#' }
#'
#' @details For the prediction to be accurate, all the SNPs that are listed in the snps file procured in this package. \link{snps}
DiabPred <- function(genofile) {
snps <- get(data("snps"))
snp_list <- as.character(snps$snp_id)
gds <- snpgdsGetGeno(genofile, snp.id = snp_list, with.id = TRUE)
matrix <- gds$genotype
colnames(matrix) <- gds$snp.id
rownames(matrix) <- gds$sample.id
predictions <- h2o.mojo_predict_df(frame = matrix,
mojo_zip_path=system.file("extdata", "model.zip", package = "DiabPred"),
genmodel_jar_path=system.file("extdata", "h2o-genmodel.jar", package = "DiabPred"))
rownames(predictions) <- gds$sample.id
return(predictions)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.