Skip to content

Commit

Permalink
add parallelization option to lioness (#281)
Browse files Browse the repository at this point in the history
* 1.2.1 (#271)

* add bioc information

* update website

* add crane and docs

* update crane

* update worflow

* update crane

* update workflows

* update workflows

* update workfolw

* update workfolw

* update workfolw

* update workfolw

* Update main.yml

* Update main.yml

* Update main.yml

* fix lioness py

* udpate lioness in R

* include calculations python

* update panda rm missing

* update panda

* update lioness joblib

* revert commits

* ALPACA fix to NAs in community assignement

* version bump

* revert lioness

* update crane with alpaca changes

* update lioness

* update lioness python

* fix test

* update workflows

* put back github actions

* Fixed typo

* Added LIONESS-pearson option + unit test

* changed param labels in LIONESS example

* updated docs for lioness() function

* Update main.yml

* Update main.yml

* Update DESCRIPTION

* fix crane issue #240

* expanded PANDA and LIONESS description

* update crane fix

* added ALPACA, EGRET, and OTTER descriptions

* Update README.md

* typo in na.rm

* update workflow

* update workflow2

* fix-actions-3

* add r lib v2

* add r lib v2

* update condor test

* update condor test

* update condor test

* update condor test

* show testthat output

* add pandoc and use cache

* use built in check

* use built in check

* update actions with built in check

* bump version

* use built in coverage

* use built in coverage

* remove sudo

* update actions

* update actions

* removed sudo from actions

* ugrade to R42

* remove virtualenv

* remove virtualenv

* remove virtualenv

* modify condor test

* update condor test

* update condor test

* adding retiucualte to covr

* adding retiucualte to covr

* add panda test to coverignore

* update actions

* remove lioness tests from coverage

* remove lioness tests from coverage

* added MONSTER and SAMBAR

* remove lionessR test

* Added CONDOR and YARN

* Update README.md

* put back otter in rbuild

* remove condor test

* remove condor test

* remove lioness docs

* add lioness to buildingore

* donttest lionesss

* remove coverage from ubuntu test

* remove rbuilignore

* update rbuildignore

* update rbuildignore

* update rbuildignore

* update rbuildignore

* update rbuildignore

* add back buildignore

* add back buildignore

* add back buildignore

* add back buildignore

* add back buildignore

* add back buildignore

* add back buildignore

* add back buildignore

* add back buildignore

* add back buildignore

* put back tests

* add padanedge diff test

* add back egeret test

* add monster test

* fix monster test

* tolerance in expect equal

* tolerance in expect equal

* tolerance in expect equal

* tolerance in expect equal

* add sourceppi

* fixed PANDA tests

* modify panda test

* update lioness test

* fix expect message

* update tests

* update tests

* update tests

* update tests

* update tests

* update tests

* reduced lioness test data

* reduced lioness test data

* reduced lioness test data

* reduced lioness test data

* reduce test size

* updating bioc (#250)

* updating bioc

* remove empty lines

* remove empty lines

* update citation

* update citation

* Update README.md

* Update README.md

* Update main.yml

* Update main.yml

* Update .Rbuildignore

* Update .Rbuildignore

* update lioness test

* removed two last lioness tests

* removed two last lioness tests

* removed two last lioness tests

* no saving of lioness networks

* no saving of lioness networks

* no saving of lioness networks

* no saving of lioness networks

* update lioness test

* lower sizeof test

* update test data

* update test data

* update test data

* reduce panda tests

* remove old test data

* remove old test data

* Update main.yml

* 1.1.16

update pandapy with header argument (#260)

* trying collapse readme (#261)

* trying collapse readme

* collapse animal description

* Update README.md

* update biconda (#265)

* add spider (#269)

* add spider

* udpate spider

* udpate spider

* update spuder with degreeadjust

* fix spider bug

Co-authored-by: Kate Hoff Shutta <kshutta@umass.edu>
Co-authored-by: katehoffshutta <43797774+katehoffshutta@users.noreply.github.com>

* 1.2.2 (#273)

- add DRAGON

* add option to run lioness on multiple cores by using parallel::mclapply in place of lapply

---------

Co-authored-by: Marouen <marouenbg@users.noreply.github.com>
Co-authored-by: Kate Hoff Shutta <kshutta@umass.edu>
Co-authored-by: katehoffshutta <43797774+katehoffshutta@users.noreply.github.com>
  • Loading branch information
4 people committed Feb 22, 2023
1 parent 4fa7999 commit b397eb6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
40 changes: 20 additions & 20 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: netZooR
Type: Package
Title: Unified methods for the inference and analysis of gene regulatory networks
Version: 1.2.1
Date: 2022-07-07
Version: 1.2.3
Date: 2023-07-21
Authors@R: c(person("Marouen", "Ben Guebila",
email = "benguebila@hsph.harvard.edu", role = c("aut","cre"), comment = c(ORCID = "0000-0001-5934-966X")),
person("Tian", "Wang",
Expand Down Expand Up @@ -37,12 +37,12 @@ biocViews:
GraphAndNetwork
Imports: RCy3,
viridisLite,
STRINGdb,
STRINGdb,
Biobase,
GOstats,
AnnotationDbi,
matrixStats,
GO.db,
matrixStats,
GO.db,
org.Hs.eg.db,
Matrix,
gplots,
Expand All @@ -51,21 +51,21 @@ Imports: RCy3,
vegan,
stats,
utils,
reshape,
reshape2,
penalized,
parallel,
doParallel,
foreach,
ggplot2,
ggdendro,
grid,
MASS,
assertthat,
tidyr,
methods,
dplyr,
graphics
reshape,
reshape2,
penalized,
parallel,
doParallel,
foreach,
ggplot2,
ggdendro,
grid,
MASS,
assertthat,
tidyr,
methods,
dplyr,
graphics
License: GPL-3
Encoding: UTF-8
LazyData: false
Expand Down
18 changes: 13 additions & 5 deletions R/LIONESS.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,16 @@ lionessPy <- function(expr_file, motif_file=NULL, ppi_file=NULL, computing="cpu"
#' transcription factor 2 (column 2) and a score (column 3) for the interaction.
#' @param network.inference.method String specifying choice of network inference method. Default is "panda".
#' 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 ... additional arguments for panda analysis
#' @keywords keywords
#' @importFrom matrixStats rowSds
#' @importFrom matrixStats colSds
#' @importFrom Biobase assayData
#' @importFrom reshape melt.array
#' @importFrom pandaR panda
#' @importFrom parallel mclapply
#' @export
#' @return A list of length N, containing objects of class "panda"
#' corresponding to each of the N samples in the expression data set.\cr
Expand All @@ -180,25 +183,30 @@ lionessPy <- function(expr_file, motif_file=NULL, ppi_file=NULL, computing="cpu"
#' @references
#' Kuijjer, M.L., Tung, M., Yuan, G., Quackenbush, J. and Glass, K., 2015.
#' Estimating sample-specific regulatory networks. arXiv preprint arXiv:1505.06440.
lioness = function(expr, motif = NULL, ppi = NULL, network.inference.method = "panda", ...){
#' 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, ...){
N <- ncol(expr)
if(ncores < 1){
print('Setting number of cores to 1.')
ncores <- 1
}
if(network.inference.method == "panda")
{
fullnet <- panda(motif, expr, ppi, ...)
return(lapply(seq_len(N), function(i) {
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
}))
}, mc.cores = ncores))
}
if(network.inference.method == "pearson")
{
fullnet <- cor(t(expr))

return(lapply(seq_len(N), function(i) {
return(mclapply(seq_len(N), function(i) {
print(paste("Computing network for sample ", i))
N * fullnet - (N - 1) * cor(t(expr[,-i]))
}))
}, mc.cores = ncores))
}
if(!(network.inference.method %in% c("panda","pearson")))
{
Expand Down

0 comments on commit b397eb6

Please sign in to comment.