#' estimateCellTypeProportions
#' Deconvolution methods for large functions
#' @param method Select a method from 37 software for estimating the proportion of cellular
#' fractions in mixed samples.they are "Abis","Adapts","Autogenes","Bayice","Bisquerna","Bseqsc",
#' Cdseq_no","Cdseq","Celldistinguisher","Cibersort","Consensustme","Dcq","Debcam","Demixt","Dtangle",
#' "Dtd","Dwls","Enigma","Epic","Estimate","Fardeep","Mcpcounter","Mixture","Momf","Music","Nitumid",
#' "Prede","Quantiseq","Scbiocpm","Scdc","Singscore","Ssgsea","Ticpe","Timer","Toast","Toast_no",
#' Xcell".
#' @param bulkdata A data.frame (nGenes x nSamples) of the genes expression from each bulk sample.
#' This matrix needs to have rownames telling the gene names (corresponds to the gene symbol in the
#' prebuilt reference profiles (e.g. CD8A, MS4A1) It is advised to keep all genes in the bulk instead
#' of a subset of signature genes.
#' @param signature A data frame representing immune cell expression profiles. Each row represents
#' an expression of a gene, and each column represents a different cell type. colnames
#' contains the name of each immune cell type and the rownames includes the genes' symbol.
#' The names of each immune cell type and the symbol of each gene should be unique.
#' @param scdata A data frame with unnormalized data with cells as columns and genes as rows.
#' @param label A cell type label of length equal to the number of columns of the scdata, with
#' each label corresponding to a column of the scdata in turn.
#' @param celltypenum For some reference-free methods, it is necessary to set the number of
#' cell types contained in the mixed sample.
#' @param tissue The tissues of bulk sample, One of "BLOOD","Gedit","LIVER","LUNG","MUSCLE","OVARY","HEART","BONE",
#' "ESOPHAGUS","STOMACH","GASTRIC","PANCREAS","CEREBELLUM", "NEUROTYPES","RETINA","EYE","THYMUS","INTESTINE",
#' "ADRENAL","ESOPHAGEAL","DUODENAL","OLFACTORY","CEREBRUM".
#' @param tumortype 23 cancer types from The Cancer Genome Atlas (TCGA).
#' @param SubMethod Subclass methods for cellular component estimation method software. Such as "NNLS".
#' @param use_docker Whether to use docker images, TRUE or FALSE.
#' @param seed the random seed
#' @param reftype defalt is NULL
#'
#' @importFrom dplyr lst
#' @importFrom BiocGenerics do.call
#' @return A data frame of Mixed cellular fractions.
#' @export
#'
#' @examples
#'
#'
#' # Bulk <- Bulk_GSE60424
#' # SC <- SC_GSE60424
#' # Label <- Label_GSE60424$Label
#' # res <- estimateCellTypeProportions(method = "Music",
#' # bulkdata = Bulk,
#' # scdata = SC,
#' # label = Label,
#' # SubMethod = "weighted",
#' use_docker = FALSE)
#'
#'
#'
#'
#'
estimateCellTypeProportions <- function(
method,
bulkdata,
signature = NULL,
scdata = NULL,
label = NULL,
celltypenum = NULL,
tissue = NULL,
tumortype = NULL,
reftype = NULL,
SubMethod = NULL,
seed = NULL,
use_docker = FALSE
){
method_R <- c("Abis","Adapts","Autogenes","Bayice","Bisquerna","Bseqsc","Gedit",
"Cdseq","Cdseq_no","Distinguisher","Cibersort","Consensustme",
"Dcq","Debcam","Demixt","Dtangle","Dtd","Dwls","Enigma",
"Epic","Estimate","Fardeep","Mcpcounter","Mixture","Momf",
"Music","Nitumid","Prede","Quantiseq","Scbiocpm","Scdc",
"Singscore","Ssgsea","Ticpe","Timer","Toast_no","Toast","Xcell")
if(any(method==method_R)){
if(use_docker){
estimate_output <- container_deconvolution(method,
bulkdata,
signature,
scdata,
label,
celltypenum,
tissue,
tumortype,
SubMethod,
reftype,
seed)
# Output
cat("\n")
cat("\n")
cat("\n")
cat(paste0("#######################",method," Method runs successfully ######################"))
cat("\n")
cat("\n")
cat("\n")
return(estimate_output)
}
else{
# Select the right method
env <- asNamespace("deconvBench")
right_method <- method
assign(right_method, get(right_method, envir = env))
# Match arguments existing in the method function
arguments <- dplyr::lst(bulkdata,
signature,
scdata,
label,
celltypenum,
reftype,
tissue,
seed,
tumortype,
SubMethod)
arguments <- arguments[intersect(names(arguments), names(formals(right_method)))]
# Execute estimation step by do.call and pass the arguments to the estimation function
estimate_output <- BiocGenerics::do.call(right_method, arguments)
# Output
cat("\n")
cat("\n")
cat("\n")
cat(paste0("#######################",method," Method runs successfully ######################"))
cat("\n")
cat("\n")
cat("\n")
return(estimate_output)
}
} else{
stop("Please enter one of the estimate cell type: Abis, Adapts, Autogenes,Bayice, Bisquerna, Bseqsc, Cdseq, Cdseq_no, Distinguisher, Cibersort, Consensustme, Dcq, Debcam, Demixt, Dtangle, Dtd, Dwls, Enigma, Epic, Estimate, Fardeep, Mcpcounter,Mixture, Momf, Music, Nitumid, Prede, Quantiseq, Scbiocpm, Scdc, Singscore, Ssgsea,Ticpe, Timer, Toast_no, Toast,Xcell.")}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.