Skip to content

Commit

Permalink
add mode parameter to lioness
Browse files Browse the repository at this point in the history
  • Loading branch information
marouenbg committed Nov 20, 2024
1 parent 6490e80 commit de4cfe4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/LIONESS.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ lionessPy <- function(expr_file, motif_file=NULL, ppi_file=NULL, computing="cpu"
#' Options include "pearson".
#' @param ncores int specifying the number of cores to be used. Default is 1.
#' (Note: constructing panda networks can be memory-intensive, and the number of cores should take into consideration available memory.)
#' @param union Aggregation mode between three input networks: Union (default), intersection, legacy (maps on motif network).
#' @param ... additional arguments for panda analysis
#' @keywords keywords
#' @importFrom matrixStats rowSds
Expand All @@ -186,7 +187,7 @@ lionessPy <- function(expr_file, motif_file=NULL, ppi_file=NULL, computing="cpu"
#' Kuijjer, M.L., Tung, M., Yuan, G., Quackenbush, J. and Glass, K., 2015.
#' Estimating sample-specific regulatory networks. arXiv preprint arXiv:1505.06440.
#' Kuijjer, M.L., Hsieh, PH., Quackenbush, J. et al. lionessR: single sample network inference in R. BMC Cancer 19, 1003 (2019). https://doi.org/10.1186/s12885-019-6235-7
lioness = function(expr, motif = NULL, ppi = NULL, network.inference.method = "panda", ncores = 1, ...){
lioness = function(expr, motif = NULL, ppi = NULL, network.inference.method = "panda", ncores = 1, mode = "union", ...){

# If both the PPI and motif are NULL, default to Pearson instead of PANDA.
if(is.null(motif) && is.null(ppi) && network.inference.method == "panda"){
Expand All @@ -200,11 +201,11 @@ lioness = function(expr, motif = NULL, ppi = NULL, network.inference.method = "p
}
if(network.inference.method == "panda")
{
fullnet <- panda(motif, expr, ppi, ...)
fullnet <- panda(motif, expr, ppi, mode = mode, ...)
return(mclapply(seq_len(N), function(i) {
print(paste("Computing network for sample ", i))
N * fullnet@regNet - (N - 1) * panda(motif, expr[, -i],
ppi, ...)@regNet
ppi, mode = mode, ...)@regNet
}, mc.cores = ncores))
}
if(network.inference.method == "pearson")
Expand Down

0 comments on commit de4cfe4

Please sign in to comment.