R/run_dwlasso.R

Defines functions run_dwlasso

Documented in run_dwlasso

# Required:
# library(DWLasso)



#' Wrapper for degree-weighted lasso method
#' 
#' Conducts co-expression analysis using DWLasso
#' @param x The n by p matrix of counts.
#' @param lambda1 A penalty parameter that controls degree sparsity of the 
#' inferred network.
#' @param lambda2 A penalty parameter that controls overall sparsity of the 
#' inferred network.
#' @param ... Additional arguments passed to `DWLasso::DWLasso()`.
#' @return A p by p matrix of association scores.
#' @export
run_dwlasso <- function(x, 
                        lambda1 = 0.4,
                        lambda2 = 2,
                        ...) {
  result <- DWLasso::DWLasso(x)

  scores <- result$mat
  scores <- (scores + t(scores)) / 2
  
  colnames(scores) <- colnames(x)
  
  return(scores)
}
tgrimes/dnapath2 documentation built on May 21, 2020, 5:53 p.m.