R/Momf.R

Defines functions Momf

Documented in Momf

#' The mehod of MOMF
#'
#' @param scdata Single data with genes in rows and cells in columns.
#' @param bulkdata A matrix with genes in rows and samples in columns.
#' @param label The cell type label of single data.
#' @importFrom MOMF momf.computeRef momf.fit
#' @return  A data frame of Mixed cellular fractions.
#' @export
#'
#' @examples
#'
#' Bulk <- Bulk_GSE60424
#' SC <- SC_GSE60424
#' Label <- Label_GSE60424$Label
#' res <- Momf(bulkdata = Bulk,
#'                    scdata = SC,
#'                    label = Label)
#'
#'




Momf <- function(scdata, bulkdata,label) {

  gene <- intersect(rownames(scdata),rownames(bulkdata))

  scdata <- scdata[gene,]

  bulkdata <- bulkdata[gene,]

  priorU <- MOMF::momf.computeRef(scdata,label)

  GList <- list(X1 = t(scdata), X2 = t(bulkdata))

  momf_res <- MOMF::momf.fit(DataX = GList,
                             DataPriorU=priorU,
                             method="KL",
                             rho=2, num_iter=100)

  res_Momf <- momf_res$cell.prop

  return(res_Momf)

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