R/TOAST.R

Defines functions Toast

Documented in Toast

#' Deconvolution Methods of TOAST
#'
#' @param signature A data-frame containing signatures of different cell types.
#' @param bulkdata   A matrix with genes in rows and samples in columns.
#'
#' @importFrom TOAST ChooseMarker MDeconv
#'
#'
#' @return  A data frame of Mixed cellular fractions.
#' @export
#'
#' @examples
#'
#' Bulk <- Bulk_GSE60424
#' res <- Toast(bulkdata = Bulk,
#'             signature = LM22)
#'
#'


Toast <- function(signature , bulkdata) {

  CellType <- as.list(1:ncol(signature))

  names(CellType) <- colnames(signature)

  myMarker <- TOAST::ChooseMarker(signature,
                                  CellType,
                                  nMarkCT = 50,
                                  chooseSig = TRUE,
                                  verbose = FALSE)

  res <- TOAST::MDeconv(Ymat = bulkdata,
                        SelMarker = myMarker,
                        alpha = NULL,
                        sigma = NULL,
                        epsilon = 1e-3,
                        maxIter = 1000,
                        verbose = FALSE)

  res_Toast <- res$H

  return(res_Toast)
}
libcell/deconvBench documentation built on Sept. 24, 2022, 12:36 p.m.