R/Xcell.R

Defines functions Xcell total.norm

Documented in Xcell

total.norm <- function(x) {
  y <- sum(x)
  z <- x/y
  return(z)
}

#' Deconvolution Methods of xCell
#'
#' @param bulkdata A matrix with genes in rows and samples in columns.
#' @import  xCell
#' @return A data frame of Mixed cellular fractions.
#' @export
#'
#'
#' @examples
#'
#' Bulk <- Bulk_GSE60424
#' res <- Xcell(bulkdata = Bulk)
#'
#'


Xcell <- function(bulkdata) {
  require(xCell)
  res <- xCell::xCellAnalysis(expr = bulkdata,
                              signatures = NULL,
                              genes = NULL,
                              spill = NULL,
                              rnaseq = TRUE,
                              file.name = NULL,
                              scale = TRUE,
                              alpha = 0.5,
                              save.raw = FALSE,
                              parallel.sz = 4,
                              parallel.type = "SOCK",
                              cell.types.use = NULL)
  res <- apply(t(res)[, 1:64], 1, total.norm)

  res_Xcell <- t(res)

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