#' Gedit
#'#' Title
#' @param bulkdata A matrix with genes in rows and samples in columns.
#' @param signature A data-frame containing signatures of different cell types.
#' @importFrom reticulate source_python
#' @importFrom utils write.table
#' @return A data frame of Mixed cellular fractions.
#' @export
#'
#' @examples
#' # Bulk <- Bulk_GSE60424
#' # res <- Gedit(bulkdata = Bulk,
#' # signature = LM22)
Gedit <- function(signature, bulkdata) {
wd_a <- getwd()
bulkdata <- bulkdata[apply(bulkdata, 1, var)!=0,]
Gedit_tmp_path <- tempdir()
Gedit_filepath <- paste0(Gedit_tmp_path,"/result_Gedit/")
if(file.exists(Gedit_filepath)){
path <- Gedit_filepath
}else{
dir.create(Gedit_filepath)
}
Symbol <- rownames(bulkdata)
bulkdata <- cbind(Symbol,bulkdata)
write.table(bulkdata, paste0(Gedit_filepath,"Bulkdata.tsv"),
sep ="\t", row.names = F,col.names = T)
symbol <- rownames(signature)
signature <- cbind(symbol,signature)
signature <- rbind(colnames(signature),signature)
write.table(signature, paste0(Gedit_filepath,"Signature.tsv"),sep = "\t",
col.names = F,row.names = F)
probpath <- system.file(package = "deconvBench")
GEDIT_probpath <- paste0(probpath,"/python/rpytools/GEDIT/")
setwd(GEDIT_probpath)
code <- paste0("python3 ", GEDIT_probpath,"GEDIT2.py",
" -mix ",Gedit_filepath,"Bulkdata.tsv",
" -ref ",Gedit_filepath,"Signature.tsv",
" -outFile ",Gedit_filepath,"res_Gedit.tsv")
system(code)
res_Gedit <- read.table(paste0(Gedit_filepath,"res_Gedit.tsv"),sep = "\t",row.names = 1,header = T)
setwd(wd_a)
return(res_Gedit)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.